Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Dir.getwd
() -> ::String
Dir.pwd → string
dir.c
View on GitHub ↗
static VALUE
dir_s_getwd(VALUE dir)
{
return rb_dir_getwd();
}
Returns the path to the current working directory:
Example
Dir.chdir("/tmp") # => 0 Dir.pwd # => "/tmp"