Method: FileMonitoring::DirStat#to_s

Defined in:
lib/file_monitoring/monitor_path.rb

#to_s(indent = 0) ⇒ Object

Returns string which contains path and state of this directory as well as it’s structure.



264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/file_monitoring/monitor_path.rb', line 264

def to_s(indent = 0)
  indent_increment = 2
  child_indent = indent + indent_increment
  res = super()
  @files.each_value do |file|
    res += "\n" + file.to_s(child_indent)
  end if @files
  @dirs.each_value do |dir|
    res += "\n" + dir.to_s(child_indent)
  end if @dirs
  res
end