class Test::Unit::Collector::TestDir::FileSystem
Attributes
              object_space[R]
            
            Public Class Methods
                              new(&block)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 78 def initialize(&block) @root = Directory.new('/', self, &block) @pwd = @root @object_space = ObjectSpace.new @required = [] end
Public Instance Methods
                              basename(name)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 119 def basename(name) name[%r"(\A/|[^/]+)/*\z", 1] end
                              chdir(to)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 141 def chdir(to) e = find(to) require_directory(to) @pwd = e end
                              directory?(name)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 91 def directory?(name) return true if (base = basename(name)) == '/' e = find(dirname(name)) return false unless(e) e.directory?(base) end
                              dirname(name)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 111 def dirname(name) if (name = name.tr_s('/', '/')) == '/' name else name[%r"\A.+(?=/[^/]+/?\z)|\A/"] || "." end end
                              entries(dir)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 85 def entries(dir) e = find(dir) require_directory(dir) e.entries end
                              expand_path(path, base = nil)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 147 def expand_path(path, base = nil) until /\A\// =~ path base ||= pwd path = join(base, path) base = nil end path.gsub!(%r"(?:/\.)+(?=/)", '') nil while path.sub!(%r"/(?!\.\./)[^/]+/\.\.(?=/)", '') path.sub!(%r"\A(?:/\.\.)+(?=/)", '') path.sub!(%r"(?:\A(/)|/)\.\.?\z", '\1') path end
                              file?(name)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 131 def file?(name) e = find(dirname(name)) return false unless(e) e.file?(basename(name)) end
                              find(path)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 98 def find(path) if(/\A\// =~ path) thing = @root else thing = @pwd end path.scan(/[^\/]+/) do |e| break thing = false unless(thing.kind_of?(Directory)) thing = thing[e] end thing end
                              join(*parts)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 127 def join(*parts) parts.join('/').gsub(%r{/+}, '/') end
                              pwd()
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 137 def pwd @pwd.path_to end
                              require(file)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 164 def require(file) return false if(@required.include?(file)) begin e = find(file) rescue Errno::ENOENT => e if(/\.rb\Z/ =~ file) raise LoadError, file end e = find(file + '.rb') end @required << file @object_space << e true rescue Errno::ENOENT raise LoadError, file end
                              require_directory(path)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 160 def require_directory(path) raise Errno::ENOTDIR, path unless(directory?(path)) end
                              split(name)
                              click to toggle source
                            
                            # File test-unit-3.3.4/test/collector/test_dir.rb, line 123 def split(name) [dirname(name), basename(name)] end