End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Dir#children
dir.children → array
dir.c
View on GitHub ↗
static VALUE
dir_collect_children(VALUE dir)
{
VALUE ary = rb_ary_new();
dir_each_entry(dir, rb_ary_push, ary, TRUE);
return ary;
}
Returns an array containing all of the filenames except for “.” and “..” in this directory.
Example
d = Dir.new("testdir") d.children #=> ["config.h", "main.rb"]