Class | FileShell |
In: |
lib/more/facets/fileshell.rb
|
Parent: | Object |
root | [R] |
# File lib/more/facets/fileshell.rb, line 33 def initialize(*root_and_options) @options = Hash === root_and_options ? root_and_options.pop : {} @root = root_and_options.first || "/" @dryrun = options[:dryrun] @quiet = options[:quiet] #@force = options[:force] end
Direct access to a directory or a file.
# File lib/more/facets/fileshell.rb, line 48 def [](name) if File.directory?(name) Dir.new(name) elsif File.file?(name) File.new(name) else nil end end
Directory listing
# File lib/more/facets/fileshell.rb, line 70 def ls(dir, options=nil) Dir.entries.collect do |f| File.directory?(f) ? Dir.new(f) : File.new(f) end end