On this page
End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class · Ruby 3.0
Dir
Objects of class Dir are directory streams representing directories in the underlying file system. They provide a variety of ways to list directories and their contents. See also File.
The directory used in these examples contains the two regular files (config.h and main.rb), the parent directory (..), and the directory itself (.).
Class methods 21
Instance methods 14
Ruby version changes 1
-
3.0
-
Dir.globandDir.[]now sort the results by default, and accept thesort:keyword option. [Feature #8709]
-