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"]
2977 2978 2979 2980 2981 2982 2983 2984 |
# File 'dir.c', line 2977 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); } |