Class: Thor::Tree
- Inherits:
-
Object
- Object
- Thor::Tree
- Defined in:
- lib/thor/tree.rb,
lib/thor/tree/file.rb,
lib/thor/tree/writer.rb,
lib/thor/tree/version.rb,
lib/thor/tree/directory.rb
Defined Under Namespace
Classes: Directory, File, Writer
Constant Summary collapse
- VERSION =
'0.2.1'
Instance Method Summary collapse
-
#initialize(file) ⇒ Tree
constructor
A new instance of Tree.
- #set_template_variable(key, value) ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize(file) ⇒ Tree
Returns a new instance of Tree.
13 14 15 |
# File 'lib/thor/tree.rb', line 13 def initialize(file) = YAML.load_file(Path(file)., safe: true).symbolize_keys! end |
Instance Method Details
#set_template_variable(key, value) ⇒ Object
17 18 19 |
# File 'lib/thor/tree.rb', line 17 def set_template_variable(key, value) Tree::File.set_template_variable key, value end |
#write ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/thor/tree.rb', line 21 def write source_paths.each do |path| Tree::File.source_paths << path end Tree::Writer.new([], {}, destination_root: [:destination_root]).tap do |w| w.write [:content] end end |