class Thor::Tree

Constants

VERSION

Public Class Methods

new(file) click to toggle source
# File lib/thor/tree.rb, line 13
def initialize(file)
  @options = YAML.load_file(Path(file).expand, safe: true).symbolize_keys!
end

Public Instance Methods

set_template_variable(key, value) click to toggle source
# File lib/thor/tree.rb, line 17
def set_template_variable(key, value)
  Tree::File.set_template_variable key, value
end
write() click to toggle source
# 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: options[:destination_root]).tap do |w|
    w.write options[:content]
  end
end

Private Instance Methods

options() click to toggle source
# File lib/thor/tree.rb, line 33
def options
  @options ||= {}
end
source_paths() click to toggle source
# File lib/thor/tree.rb, line 37
def source_paths
  options[:source_paths] ||= []
end