Method: Mtree::FileSpecification#to_s

Defined in:
lib/mtree/file_specification.rb

#to_s(options = {}) ⇒ Object



128
129
130
131
132
133
134
135
136
137
138
# File 'lib/mtree/file_specification.rb', line 128

def to_s(options = {})
  descendent = ''
  if children.any?
    descendent = children.map do |child|
      child.to_s(options)
    end.join
    descendent.gsub!(/^/, '    ') if options[:indent]
  end

  "#{filename} #{attributes}\n#{descendent}..\n"
end