End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Pathname#realpath
realpath(p1 = v1)
ext/pathname/pathname.c
View on GitHub ↗
static VALUE
path_realpath(int argc, VALUE *argv, VALUE self)
{
VALUE basedir, str;
rb_scan_args(argc, argv, "01", &basedir);
str = rb_funcall(rb_cFile, id_realpath, 2, get_strpath(self), basedir);
return rb_class_new_instance(1, &str, rb_obj_class(self));
}
Returns the real (absolute) pathname for self in the actual filesystem.
Does not contain symlinks or useless dots, .. and ..
All components of the pathname must exist when this method is called.
See also
#realdirpath
#relative?
#readlink
#relative_path_from
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1