Method: Dir.entries
- Defined in:
- dir.c
.entries(dirname) ⇒ Array .entries(dirname, encoding: enc) ⇒ Array
Returns an array containing all of the filenames in the given directory. Will raise a SystemCallError if the named directory doesn’t exist.
The optional encoding keyword argument specifies the encoding of the directory. If not specified, the filesystem encoding is used.
Dir.entries("testdir") #=> [".", "..", "config.h", "main.rb"]
3032 3033 3034 3035 3036 3037 3038 3039 |
# File 'dir.c', line 3032
static VALUE
dir_entries(int argc, VALUE *argv, VALUE io)
{
VALUE dir;
dir = dir_open_dir(argc, argv);
return rb_ensure(dir_collect, dir, dir_close, dir);
}
|