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

instance method Pathname#relative?

relative? -> bool[permalink][rdoc]

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



require 'pathname'

p = Pathname.new('/im/sure')
p.relative? #=> false

p = Pathname.new('not/so/sure')
p.relative? #=> true