method

each_child

ruby latest stable - Class: Dir

Method not available on this version

This method is only available on newer versions. The first available version (v2_6_3) is shown here.

each_child()
public

Calls the block once for each entry except for “.” and “..” 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_child  {|x| puts "Got #{x}" }

produces:

Got config.h
Got main.rb