class Timelime::Tree

Public Class Methods

new(paths) click to toggle source
# File lib/timelime/tree.rb, line 7
def initialize paths

  @todo = []
  paths.each do |path|
    @todo += walk path
  end

end

Public Instance Methods

get() { |path| ... } click to toggle source
# File lib/timelime/tree.rb, line 16
def get(&block)

  unless block == nil
    @todo.each do |path|
      yield path
    end
  end

  @todo

end

Private Instance Methods

walk(path) click to toggle source
# File lib/timelime/tree.rb, line 30
def walk path

  unless File.exist? path
    return []
  end

  buf = []

  if File.directory? path
    Dir[path + "/*"].each do |p|
      buf += walk p
    end
  else
    buf += [path]
  end

  buf

end