るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.041秒)
トップページ > クエリ:>[x] > クエリ:name[x] > バージョン:2.3.0[x] > ライブラリ:pathname[x] > クエリ:parent[x]

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. integer >
  4. complex >
  5. comparable >

クラス

検索結果

Pathname#parent -> Pathname (64072.0)

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

...を指す新しい Pathname オブジェクトを返します。

//emlist[例 絶対パス][ruby]{
require "pathname"

path = Pathname("/usr")
path # => #<Pathname:/usr>
path.parent # => #<Pathname:/>
//}

//emlist[例 相対パス][ruby]{
require "pathname"

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