Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

File.path

(::path path) -> ::String
File.path(path) → string

Returns a string representation of the given path:

Example
File.path(File::NULL) # => "/dev/null"
File.path('/tmp')     # => "/tmp"
File.path('../ruby')  # => "../ruby"
File.path($stdin)     # => "<STDIN>"
File.path('nosuch')   # => "nosuch"
See also .owned? .pipe? .open .readable? also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0