Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Pathname#cleanpath
cleanpath(consider_symlink=false)
ext/pathname/lib/pathname.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/ext/pathname/lib/pathname.rb, line 94
def cleanpath(consider_symlink=false)
if consider_symlink
cleanpath_conservative
else
cleanpath_aggressive
end
end
Returns clean pathname of self with consecutive slashes and useless dots removed. The filesystem is not accessed.
If consider_symlink is true, then a more conservative algorithm is used to avoid breaking symbolic linkages. This may retain more .. entries than absolutely necessary, but without accessing the filesystem, this can’t be avoided.
See Pathname#realpath.