180件ヒット
[1-100件を表示]
(0.067秒)
別のキーワード
種類
- インスタンスメソッド (84)
- モジュール関数 (48)
- 特異メソッド (48)
クラス
- Exception (12)
- File (48)
- IO (24)
- Thread (24)
- TracePoint (24)
キーワード
-
backtrace
_ locations (24) -
caller
_ locations (24) - fdatasync (12)
- flush (12)
- inspect (12)
- new (12)
- open (24)
- readlink (12)
-
set
_ backtrace (12) -
world
_ readable? (12) -
world
_ writable? (12)
検索結果
先頭5件
-
TracePoint
# path -> String (18121.0) -
イベントが発生したファイルのパスを返します。
...トが発生したファイルのパスを返します。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.path # => "/path/to/test.rb"
end
trace.enable
foo 1
//}... -
FileTest
. # world _ readable?(path) -> Integer | nil (3125.0) -
path が全てのユーザから読めるならばそのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。
...
path が全てのユーザから読めるならばそのファイルのパーミッションを表す
整数を返します。そうでない場合は nil を返します。
整数の意味はプラットフォームに依存します。
@param path パスを表す文字列を指定します。......m = FileTest.world_readable?("/etc/passwd")
"%o" % m # => "644"... -
FileTest
. # world _ writable?(path) -> bool (3125.0) -
path が全てのユーザから書き込めるならば、そのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。
...
path が全てのユーザから書き込めるならば、そのファイルのパーミッションを表す
整数を返します。そうでない場合は nil を返します。
整数の意味はプラットフォームに依存します。
@param path パスを表す文字列を指定し......ます。
m = FileTest.world_writable?("/tmp")
"%o" % m #=> "777"... -
Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil (158.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
#....../Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9......, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller... -
Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil (158.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...][ruby]{
def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
#....../Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9......, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}
@see Thread::Backtrace::Location, Kernel.#caller... -
File
. new(path , mode = "r" , perm = 0666) -> File (145.0) -
path で指定されるファイルをオープンし、File オブジェクトを生成して 返します。
...
path で指定されるファイルをオープンし、File オブジェクトを生成して
返します。
path が整数の場合はファイルディスクリプタとして扱い、それに対応する
File オブジェクトを生成して返します。IO.open と同じです。
ブロ......ロックの実行が終了すると、ファイルは自動的に
クローズされます。ブロックの実行結果を返します。
@param path ファイルを文字列で指定します。整数を指定した場合はファイルディスクリプタとして扱います。
@param mode......み込みモードでのファイルオープン][ruby]{
f = File.new("testfile", "r")
f.class # => File
f.close
//}
//emlist[例: File.open による読み込みモードでのファイルオープン][ruby]{
f = File.open("testfile", "r")
f.class # => File
f.close
//}
//emlist[例: File.open に... -
File
. open(path , mode = "r" , perm = 0666) -> File (145.0) -
path で指定されるファイルをオープンし、File オブジェクトを生成して 返します。
...
path で指定されるファイルをオープンし、File オブジェクトを生成して
返します。
path が整数の場合はファイルディスクリプタとして扱い、それに対応する
File オブジェクトを生成して返します。IO.open と同じです。
ブロ......ロックの実行が終了すると、ファイルは自動的に
クローズされます。ブロックの実行結果を返します。
@param path ファイルを文字列で指定します。整数を指定した場合はファイルディスクリプタとして扱います。
@param mode......み込みモードでのファイルオープン][ruby]{
f = File.new("testfile", "r")
f.class # => File
f.close
//}
//emlist[例: File.open による読み込みモードでのファイルオープン][ruby]{
f = File.open("testfile", "r")
f.class # => File
f.close
//}
//emlist[例: File.open に... -
File
. open(path , mode = "r" , perm = 0666) {|file| . . . } -> object (145.0) -
path で指定されるファイルをオープンし、File オブジェクトを生成して 返します。
...
path で指定されるファイルをオープンし、File オブジェクトを生成して
返します。
path が整数の場合はファイルディスクリプタとして扱い、それに対応する
File オブジェクトを生成して返します。IO.open と同じです。
ブロ......ロックの実行が終了すると、ファイルは自動的に
クローズされます。ブロックの実行結果を返します。
@param path ファイルを文字列で指定します。整数を指定した場合はファイルディスクリプタとして扱います。
@param mode......み込みモードでのファイルオープン][ruby]{
f = File.new("testfile", "r")
f.class # => File
f.close
//}
//emlist[例: File.open による読み込みモードでのファイルオープン][ruby]{
f = File.open("testfile", "r")
f.class # => File
f.close
//}
//emlist[例: File.open に... -
File
. readlink(path) -> String (121.0) -
シンボリックリンクのリンク先のパスを文字列で返します。
...@param path シンボリックリンクを表す文字列を指定します。
@raise Errno::EXXX 指定された path がシンボリックリンクでない場合や、リンクの読み取りに失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.sym......link("testfile", "testlink") # => 0
File.readlink("testlink") # => "testfile"
//}...