Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Pathname#dirname
dirname
ext/pathname/pathname.c
View on GitHub ↗
static VALUE
path_dirname(VALUE self)
{
VALUE str = get_strpath(self);
str = rb_funcall(rb_cFile, id_dirname, 1, str);
return rb_class_new_instance(1, &str, rb_obj_class(self));
}
Returns all but the last component of the path.
See File.dirname.