44件ヒット
[1-44件を表示]
(0.329秒)
検索結果
先頭4件
-
Kernel
. # set _ trace _ func(proc) -> Proc (27332.0) -
Ruby インタプリタのイベントをトレースする Proc オブジェクトとして 指定された proc を登録します。 nil を指定するとトレースがオフになります。
...Ruby インタプリタのイベントをトレースする Proc オブジェクトとして
指定された proc を登録します。 nil を指定するとトレースがオフになります。
Ruby インタプリタがプログラムを実行する過程で、メソッドの呼び出しや......録された Proc オブジェクトを実行します。
標準添付の debug、tracer、
profile はこの組み込み関数を利用して実現されています。
=== ブロックパラメータの意味
渡す Proc オブジェクトのパラメータは
//emlist[][ruby]{
proc{|event, fil......トップレベルでは nil。
//}
@param proc トレース用 Proc オブジェクトを指定します。nil を指定した場合、トレースをオフにします。
@return proc を返します。
//emlist[例][ruby]{
set_trace_func lambda {|*arg|
p arg
}
class Foo
end
43.to_s
# ----結... -
Kernel
. # caller(range) -> [String] | nil (9079.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...。
@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得するスタックの個数を指定します。
@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。
@see Kernel.#set_tr......ace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main>'"]
# ["-:10:in `bar'", "-:13:in `<main>'"]
# ["-:13:in `<m......//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end
def foo
p parse_caller(caller.first)
end
def bar
foo
p parse_caller(caller.first)
end
bar
p parse_caller(caller.first)
#=... -
Kernel
. # caller(start = 1) -> [String] | nil (9079.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...。
@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得するスタックの個数を指定します。
@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。
@see Kernel.#set_tr......ace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main>'"]
# ["-:10:in `bar'", "-:13:in `<main>'"]
# ["-:13:in `<m......//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end
def foo
p parse_caller(caller.first)
end
def bar
foo
p parse_caller(caller.first)
end
bar
p parse_caller(caller.first)
#=... -
Kernel
. # caller(start , length) -> [String] | nil (9079.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...。
@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得するスタックの個数を指定します。
@param range 取得したいスタックの範囲を示す Range オブジェクトを指定します。
@see Kernel.#set_tr......ace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main>'"]
# ["-:10:in `bar'", "-:13:in `<main>'"]
# ["-:13:in `<m......//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end
def foo
p parse_caller(caller.first)
end
def bar
foo
p parse_caller(caller.first)
end
bar
p parse_caller(caller.first)
#=...