49件ヒット
[1-49件を表示]
(0.038秒)
種類
- インスタンスメソッド (33)
- 特異メソッド (11)
- 文書 (5)
キーワード
-
NEWS for Ruby 2
. 7 . 0 (5) - realdirpath (11)
検索結果
先頭5件
-
Pathname
# realpath(basedir = nil) -> Pathname (18233.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...mdir("/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... -
File
. realpath(pathname , basedir = nil) -> String (18220.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 (18133.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...mdir("/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
# realdirpath(basedir = nil) -> Pathname (129.0) -
Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に 存在しなくてもエラーになりません。
...Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に
存在しなくてもエラーになりません。
@param basedir ベースディレクトリを指定します。省略するとカレントディレクトリになります。
//emlist[例][ruby]{
require "pathna......st")
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... -
NEWS for Ruby 2
. 7 . 0 (84.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...で**nilと書くことで、このメソッドがキーワードを
受け取らないことを明示できるようになりました。このようなメソッドを
キーワード引数付きで呼び出すとArgumentErrorになります。 14183
//emlist[][ruby]{
def foo(h, **nil); en......d; foo(key: 1) # ArgumentError
def foo(h, **nil); end; foo(**{key: 1}) # ArgumentError
def foo(h, **nil); end; foo("str" => 1) # ArgumentError
def foo(h, **nil); end; foo({key: 1}) # OK
def foo(h, **nil); end; foo({"str" => 1}) # OK
//}
* キーワード引数を受け取らない......した。
//emlist{
$ ./configure --with-coroutine=ucontext
$ ./configure --with-coroutine=copy
//}
* File
* File.realpathは多くのプラットフォームでrealpath(3)を使います。
これは大幅にパフォーマンスを改善します。 15797
* Hash
* 小さいHas...