種類
- インスタンスメソッド (12)
- 特異メソッド (1)
キーワード
- binding (1)
-
callee
_ id (1) - disable (2)
- enabled? (1)
- event (1)
-
instruction
_ sequence (1) -
method
_ id (1) - new (1)
- parameters (1)
-
return
_ value (1)
検索結果
先頭5件
-
TracePoint
# enable -> bool (96688.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 (96688.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
# enabled? -> bool (60628.0) -
self のトレースが有効な場合に true を、そうでない場合に false を返しま す。
...self のトレースが有効な場合に true を、そうでない場合に false を返しま
す。
@see TracePoint#enable, TracePoint#disable... -
TracePoint
# binding -> Binding (42628.0) -
発生したイベントによって生成された Binding オブジェクトを返します。
...発生したイベントによって生成された Binding オブジェクトを返します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}... -
TracePoint
# disable -> bool (42346.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 (42346.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
. new(*events) {|obj| . . . } -> TracePoint (24412.0) -
新しい TracePoint オブジェクトを作成して返します。トレースを有効 にするには TracePoint#enable を実行してください。
...新しい TracePoint オブジェクトを作成して返します。トレースを有効
にするには TracePoint#enable を実行してください。
//emlist[例:irb で実行した場合][ruby]{
trace = TracePoint.new(:call) do |tp|
p [tp.lineno, tp.defined_class, tp.method_id, tp.even......t]
end
# => #<TracePoint:0x007f17372cdb20>
trace.enable
# => false
puts "Hello, TracePoint!"
# ...
# [69, IRB::Notifier::AbstractNotifier, :printf, :call]
# ...
//}
トレースを無効にするには TracePoint#disable を実行してください。
//emlist[][ruby]{
trace.disable
//}
@param......ベントに関連しない情報を取得するメソッドを実行した場合には
RuntimeError が発生します。
//emlist[例][ruby]{
TracePoint.trace(:line) do |tp|
p tp.raised_exception
end
# => RuntimeError: 'raised_exception' not supported by this event
//}
イベントフック... -
TracePoint
# parameters -> [object] (24400.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
# return _ value -> object (24346.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
//}... -
TracePoint
# callee _ id -> Symbol | nil (24328.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
# event -> Symbol (24328.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 (24328.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
# method _ id -> Symbol | nil (24328.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...