Ruby 1.9.0 リファレンスマニュアル > ライブラリ一覧 > library _builtin > class File > path

instance method File#path

path -> String
to_path -> String

オープン時に使用したパスを文字列で返します。

File.new("testfile").path               #=> "testfile"
File.new("/tmp/../tmp/xxx", "w").path   #=> "/tmp/../tmp/xxx"