class Algerb::Files

Attributes

files[R]
name[R]

Public Class Methods

new(name = nil, files = {}) click to toggle source
# File lib/algerb/files.rb, line 7
def initialize(name = nil, files = {})
  @name = name
  @files = files
end
root(files = {}) click to toggle source
# File lib/algerb/files.rb, line 12
def self.root(files = {})
  new(nil, files)
end

Public Instance Methods

==(another) click to toggle source
# File lib/algerb/files.rb, line 35
def ==(another)
  self.name == another.name and self.files == another.files
end
add(file) click to toggle source
# File lib/algerb/files.rb, line 16
def add(file)
  @files[file.name] = file unless @files.has_key?(file.name)
  self
end
find_by_path(path) click to toggle source
# File lib/algerb/files.rb, line 21
def find_by_path(path)
  next_path, rest = split_path_as_head_and_tail(path)
  if files.has_key?(next_path)
    found = files[next_path]
    if rest.nil?
      found
    elsif found.is_a?(Algerb::Files)
      found.find_by_path(rest)
    else
      found
    end
  end
end