Method: Dir.foreach
- Defined in:
- dir.c
.foreach(dirname) {|filename| ... } ⇒ nil
Calls the block once for each entry in the named directory, passing the filename of each entry as a parameter to the block.
Dir.foreach("testdir") {|x| puts "Got #{x}" }
produces:
Got .
Got ..
Got config.h
Got main.rb
1805 1806 1807 |
# File 'dir.c', line 1805 static VALUE dir_foreach(io, dirname) VALUE io, dirname; |