るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.062秒)

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

ライブラリ

クラス

検索結果

Pathname#realdirpath(basedir = nil) -> Pathname (18315.0)

Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に 存在しなくてもエラーになりません。

...= Pathname("/not_exist")
path.realdirpath # => #<Pathname:/not_exist>
path.realpath # => Errno::ENOENT

# 最後ではないコンポーネント(/not_exist_1)も存在しないのでエラーになる。
path = Pathname("/not_exist_1/not_exist_2")
path.realdirpath # => Errno::ENOENT
//}

@see...

Pathname#realpath(basedir = nil) -> Pathname (244.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...rescue nil
File.unlink("/tmp/bar/foo") rescue nil
Dir.rmdir("/tmp/bar") rescue nil

Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File.symlink("../foo", "/tmp/bar/foo")
path = Pathname.new("bar/././//foo/../bar")

Dir.chdir("/tmp")

p path.realpath

# => ruby 1.8.0 (2003-10-10) [i586-linux]
#...
...#<Pathname:/tmp/bar>
//}

@see Pathname#realdirpath, File.realpath...

Pathname#realpath -> Pathname (144.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...rescue nil
File.unlink("/tmp/bar/foo") rescue nil
Dir.rmdir("/tmp/bar") rescue nil

Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File.symlink("../foo", "/tmp/bar/foo")
path = Pathname.new("bar/././//foo/../bar")

Dir.chdir("/tmp")

p path.realpath

# => ruby 1.8.0 (2003-10-10) [i586-linux]
#...
...#<Pathname:/tmp/bar>
//}

@see Pathname#realdirpath, File.realpath...