class Test::Unit::Collector::TestDir::FileSystem::Directory

Public Class Methods

new(name, fs, parent=self, &block) click to toggle source
# File test-unit-3.3.4/test/collector/test_dir.rb, line 11
def initialize(name, fs, parent=self, &block)
  @name = name
  @fs = fs
  @parent = parent
  @contents = {'.' => self, '..' => parent}
  instance_eval(&block) if(block)
end

Public Instance Methods

[](name) click to toggle source
# File test-unit-3.3.4/test/collector/test_dir.rb, line 46
def [](name)
  raise Errno::ENOENT, name unless(@contents.include?(name))
  @contents[name]
end
dir(name, &block) click to toggle source
# File test-unit-3.3.4/test/collector/test_dir.rb, line 23
def dir(name, &block)
  @contents[name] = self.class.new(name, @fs, self, &block)
end
directory?(name) click to toggle source
# File test-unit-3.3.4/test/collector/test_dir.rb, line 31
def directory?(name)
  return true if(name.nil? || name.empty?)
  return false unless(@contents.include?(name))
  @contents[name].kind_of?(self.class)
end
entries() click to toggle source
# File test-unit-3.3.4/test/collector/test_dir.rb, line 27
def entries
  @contents.keys
end
exist?(name) click to toggle source
# File test-unit-3.3.4/test/collector/test_dir.rb, line 42
def exist?(name)
  @contents.include?(name)
end
file(name, contents) click to toggle source
# File test-unit-3.3.4/test/collector/test_dir.rb, line 19
def file(name, contents)
  @contents[name] = contents
end
file?(name) click to toggle source
# File test-unit-3.3.4/test/collector/test_dir.rb, line 37
def file?(name)
  return false unless(@contents.include?(name))
  !directory?(name)
end
path_to(name=nil) click to toggle source
# File test-unit-3.3.4/test/collector/test_dir.rb, line 51
def path_to(name=nil)
  if(!name)
    @parent.path_to(@name)
  elsif(@parent == self)
    @fs.join('/', name)
  else
    @fs.join(@parent.path_to(@name), name)
  end
end