method

foreach

v1_8_6_287 - Show latest stable - Class: Dir
foreach(p1)
public

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