Ruby 2.5.0 リファレンスマニュアル > ライブラリ一覧 > pathnameライブラリ > Pathnameクラス > absolute?

instance method Pathname#absolute?

absolute? -> bool[permalink][rdoc]

self が絶対パス指定であれば真を返します。



require "pathname"

pathname = Pathname("/path/to/example.rb")
pathname.absolute? # => true
pathname = Pathname("../")
pathname.absolute? # => false