instance method Pathname#parent

parent -> Pathname[permalink][rdoc][edit]

self の親ディレクトリを指す新しい Pathname オブジェクトを返します。

例 絶対パス

require "pathname"

path = Pathname("/usr")
path        # => #<Pathname:/usr>
path.parent # => #<Pathname:/>
例 相対パス

require "pathname"

path = Pathname("foo/bar")
path.parent               # => #<Pathname:foo>
path.parent.parent        # => #<Pathname:.>
path.parent.parent.parent # => #<Pathname:..>