別のキーワード
キーワード
-
callee
_ id (1) - disable (2)
- enable (2)
-
eval
_ script (1) - event (1)
-
instruction
_ sequence (1) - lineno (1)
-
method
_ id (1) - parameters (1)
- path (1)
-
raised
_ exception (1) -
return
_ value (1)
検索結果
先頭5件
-
TracePoint
# disable -> bool (49.0) -
self のトレースを無効にします。
...self のトレースを無効にします。
実行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => true
trace.disable # => false (実行前......true
//}
[注意] イベントフックのためのメソッドに、ブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
trace.enable { p trace.lineno }
# => RuntimeError: access from outside
@see TracePoint#enable, TracePoint#enabled?... -
TracePoint
# disable { . . . } -> object (49.0) -
self のトレースを無効にします。
...self のトレースを無効にします。
実行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => true
trace.disable # => false (実行前......true
//}
[注意] イベントフックのためのメソッドに、ブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
trace.enable { p trace.lineno }
# => RuntimeError: access from outside
@see TracePoint#enable, TracePoint#enabled?... -
TracePoint
# enable -> bool (49.0) -
self のトレースを有効にします。
...self のトレースを有効にします。
実行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行......イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
//emlist[例][ruby]{
trace.enable { p trace.lineno }
# => RuntimeError: access from outside
//}
@see TracePoint#disable, TracePoint#enabled?... -
TracePoint
# enable { . . . } -> object (49.0) -
self のトレースを有効にします。
...self のトレースを有効にします。
実行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行......イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
//emlist[例][ruby]{
trace.enable { p trace.lineno }
# => RuntimeError: access from outside
//}
@see TracePoint#disable, TracePoint#enabled?... -
TracePoint
# callee _ id -> Symbol | nil (31.0) -
イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。
...した場合に発生します。
//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end
trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
end
trace.enable do
C.new.alias_name
end
//}
@see TracePoint#method_id... -
TracePoint
# eval _ script -> String | nil (31.0) -
script_compiledイベント発生時にコンパイルされたソースコードを返します。 ファイルから読み込んだ場合は、nilを返します。
...パイルされたソースコードを返します。
ファイルから読み込んだ場合は、nilを返します。
//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.eval_script # => "puts 'hello'"
end.enable do
eval("puts 'hello'")
end
//}
@raise RuntimeError :script_co... -
TracePoint
# event -> Symbol (31.0) -
発生したイベントの種類を Symbol で返します。
...生するイベントの詳細については、TracePoint.new を参照してくださ
い。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call, :return) do |tp|
p tp.event
end
tr... -
TracePoint
# instruction _ sequence -> RubyVM :: InstructionSequence (31.0) -
script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。
...pt_compiledイベント発生時にコンパイルされた
RubyVM::InstructionSequenceインスタンスを返します。
//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval("put... -
TracePoint
# lineno -> Integer (31.0) -
発生したイベントの行番号を返します。
...発生したイベントの行番号を返します。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call, :return) do |tp|
tp.lineno
end
trace.enable
foo 1
# => 1
# 3
//}... -
TracePoint
# method _ id -> Symbol | nil (31.0) -
イベントが発生したメソッドの定義時の名前を Symbol で返します。 トップレベルであった場合は nil を返します。
...した場合に発生します。
//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end
trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
end
trace.enable do
C.new.alias_name
end
//}
@see TracePoint#callee_id... -
TracePoint
# parameters -> [object] (31.0) -
現在のフックが属するメソッドまたはブロックのパラメータ定義を返します。 フォーマットは Method#parameters と同じです。
...イベントのためのイベントフックの外側で実行した場合に発生します。
//emlist[例][ruby]{
def foo(a, b = 2)
end
TracePoint.new(:call) do |tp|
p tp.parameters # => a], [:opt, :b
end.enable do
foo(1)
end
//}
@see Method#parameters, UnboundMethod#parameters, Proc#... -
TracePoint
# path -> String (31.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
//}... -
TracePoint
# raised _ exception -> Exception (31.0) -
発生した例外を返します。
...eError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。
//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided by 0>
end
trace.enable
begin
0/0
rescue
end
//}... -
TracePoint
# return _ value -> object (31.0) -
メソッドやブロックの戻り値を返します。
...timeError :return、:c_return、:b_return イベントのためのイベ
ントフックの外側で実行した場合に発生します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:return) do |tp|
p tp.return_value # => 1
end
trace.enable
foo 1
//}...