38件ヒット
[1-38件を表示]
(0.043秒)
検索結果
先頭4件
-
File
. realpath(pathname , basedir = nil) -> String (39143.0) -
与えられた pathname に対応する絶対パスを返します。
...合に発生します。
//emlist[例][ruby]{
ENV["HOME"] # => "/home/matz"
File.symlink("testfile", "testlink")
File.realpath("testfile") # => "/home/matz/testfile"
File.realpath("testlink") # => "/home/matz/testfile"
File.realpath("..", "/tmp") # => "/"
//}... -
Pathname
# realpath -> Pathname (18132.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...ir("/tmp/foo") 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(basedir = nil) -> Pathname (18132.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...ir("/tmp/foo") 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... -
NEWS for Ruby 2
. 7 . 0 (48.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ます。 10344
* File
* 新規メソッド
* パスが絶対パスかどうかをポータブルに判定するFile.absolute_path?メソッドが追加されました。 15868
* 変更されたメソッド
* Windows以外のプラットフォームでFile.extnameが「.」で......終わる文字列に対して
「.」を返すようになりました。 15267
//emlist[][ruby]{
File.extname("foo.") #=> "."
//}
* FrozenError
* 新規メソッド
* 変更しようとしたfreezeされたオブジェクトを返すFrozenError#receiverメソッドが......なりました。
//emlist{
$ ./configure --with-coroutine=ucontext
$ ./configure --with-coroutine=copy
//}
* File
* File.realpathは多くのプラットフォームでrealpath(3)を使います。
これは大幅にパフォーマンスを改善します。 15797
* Hash
* 小...