End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Pathname#root?
root?
ext/pathname/lib/pathname.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/ext/pathname/lib/pathname.rb, line 216
def root?
chop_basename(@path) == nil && /#{SEPARATOR_PAT}/o.match?(@path)
end
Predicate method for root directories. Returns true if the pathname consists of consecutive slashes.
It doesn’t access the filesystem. So it may return false for some pathnames which points to roots such as /usr/...