Method: Dir#each_child

Defined in:
dir.c

#each_child {|filename| ... } ⇒ Dir #each_childObject

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

Overloads:

  • #each_child {|filename| ... } ⇒ Dir

    Yields:

    • (filename)

    Returns:

[View source]

3101
3102
3103
3104
3105
3106
# File 'dir.c', line 3101

static VALUE
dir_each_child_m(VALUE dir)
{
    RETURN_ENUMERATOR(dir, 0, 0);
    return dir_each_entry(dir, dir_yield, Qnil, TRUE);
}