new

Dir.new( string ) â aDir Class Public methods Returns a new directory object for the named directory.

open

Dir.open( string ) â aDirDir.open( string ) {| aDir | block } â anObject Class Public methods With no block, open is a synonym for Dir::new. If a block is present, it is passed aDir as a parameter. The directory is closed at the end of the block, and Dir::open returns the value of the block.

pwd

Dir.pwd â string Class Public methods Returns the path to the current working directory of this process as a string. Dir.chdir("/tmp") #=> 0 Dir.getwd #=> "/tmp"

rmdir

Dir.rmdir( string ) â 0 Class Public methods Deletes the named directory. Raises a subclass of SystemCallError if the directory isn't empty.

tmpdir

tmpdir() Class Public methods Returns the operating system's temporary file path.

unlink

Dir.unlink( string ) â 0 Class Public methods Deletes the named directory. Raises a subclass of SystemCallError if the directory isn't empty.

close

dir.close â nil Instance Public methods Closes the directory stream. Any further attempts to access dir will raise an IOError. d = Dir.new("testdir") d.close #=> nil

each

dir.each { |filename| block } â dirdir.each â an_enumerator Instance Public methods Calls the block once for each entry in this directory, passing the filename of each entry as a parameter to the block. If no block is given, an enumerator is returned instead. d = Dir.new("testdir") d.each {|x| puts "Got #{x}" } produces: Got . Got .. Got config.h Got main.rb

inspect

dir.inspect â string Instance Public methods Return a string describing this Dir object.

path

dir.path â string or nil Instance Public methods Returns the path parameter passed to dir's constructor. d = Dir.new("..") d.path #=> ".."