Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Dir#path
() -> ::String?
path → string or nil
dir.c
View on GitHub ↗
static VALUE
dir_path(VALUE dir)
{
struct dir_data *dirp;
TypedData_Get_Struct(dir, struct dir_data, &dir_data_type, dirp);
if (NIL_P(dirp->path)) return Qnil;
return rb_str_dup(dirp->path);
}
Returns the dirpath string that was used to create self (or nil if created by method Dir.for_fd):
Example
Dir.new('example').path # => "example"