Sha256: 80100f682e73189ea839b0ed032d7c235b4970bb4b2723e5dd5058e79223ed49
Contents?: true
Size: 600 Bytes
Versions: 9
Compression:
Stored size: 600 Bytes
Contents
require 'fileutils' class FileSystem include FileUtils attr_reader :root def initialize( ) @root = "/" end def root?(dir=nil) pth = File.expand_path(dir||work) return true if pth == '/' return true if pth =~ /^(\w:)?\/$/ false end def work; Dir.pwd; end def ls Dir.entries.collect do |f| File.directory?(f) ? Dir.new(f) : File.new(f) end end # Direct access to a directory or file. def [](name) if File.directory?(name) Dir.new(name) elsif File.file?(name) File.new(name) else nil end end end
Version data entries
9 entries across 9 versions & 1 rubygems