End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Pathname#absolute?
absolute?
ext/pathname/lib/pathname.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/ext/pathname/lib/pathname.rb, line 231
def absolute?
ABSOLUTE_PATH.match? @path
end
Predicate method for testing whether a path is absolute.
It returns true if the pathname begins with a slash.
Example
p = Pathname.new('/im/sure') p.absolute? #=> true p = Pathname.new('not/so/sure') p.absolute? #=> false