Ruby 1.8.7 Reference Manual > All Libraries > Builtin Library > class File > path

instance method File#path

path -> String

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

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