Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Dir.new

Dir.new( string ) → aDir
Dir.new( string, encoding: enc ) → aDir

Returns a new directory object for the named directory.

The optional encoding keyword argument specifies the encoding of the directory. If not specified, the filesystem encoding is used.

See also .mktmpdir .open .mkdir .pwd also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0