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
file.c
View on GitHub ↗
static VALUE
rb_file_s_path(VALUE klass, VALUE fname)
{
return rb_get_path(fname);
}
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"