class Thor::Tree::Writer
Public Class Methods
new(args=[], options={}, config={})
click to toggle source
Calls superclass method
# File lib/thor/tree/writer.rb, line 12 def initialize(args=[], options={}, config={}) super Writer.root_path = Path(destination_root).expand end
root_path()
click to toggle source
# File lib/thor/tree/writer.rb, line 9 def root_path; @_destination_root; end
root_path=(path)
click to toggle source
Destination root for class
# File lib/thor/tree/writer.rb, line 8 def root_path=(path); @_destination_root = path; end
Public Instance Methods
write(contents)
click to toggle source
# File lib/thor/tree/writer.rb, line 18 def write(contents) return unless contents.is_a?(Hash) Tree::Directory.new([Writer.root_path]).tap do |root| contents.each do |content_path, options| root.add content_path, options end end.write end