194件ヒット
[1-100件を表示]
(0.022秒)
種類
- インスタンスメソッド (183)
- 特異メソッド (11)
キーワード
- binding (11)
-
callee
_ id (11) -
defined
_ class (11) - disable (22)
- enabled? (11)
-
eval
_ script (6) - event (11)
- inspect (11)
-
instruction
_ sequence (6) - lineno (11)
-
method
_ id (11) - new (11)
- parameters (6)
- path (11)
-
raised
_ exception (11) -
return
_ value (11)
検索結果
先頭5件
-
TracePoint
# enable -> bool (18129.0) -
self のトレースを有効にします。
...の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行前の状態)
# トレースが有効
trace.enabled?......rue
trace.enable # => true (実行前の状態)
# 引き続きトレースが有効
//}
ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。
//emlist[例][ruby]{
trace.enabled? # =>......false
trace.enable do
trace.enabled? # => true
end
trace.enabled? # => false
//}
[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
//emlist[例][ruby]{
trace.enable { p trace.li... -
TracePoint
# enable { . . . } -> object (18129.0) -
self のトレースを有効にします。
...の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行前の状態)
# トレースが有効
trace.enabled?......rue
trace.enable # => true (実行前の状態)
# 引き続きトレースが有効
//}
ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。
//emlist[例][ruby]{
trace.enabled? # =>......false
trace.enable do
trace.enabled? # => true
end
trace.enabled? # => false
//}
[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
//emlist[例][ruby]{
trace.enable { p trace.li... -
TracePoint
# enabled? -> bool (6109.0) -
self のトレースが有効な場合に true を、そうでない場合に false を返しま す。
...self のトレースが有効な場合に true を、そうでない場合に false を返しま
す。
@see TracePoint#enable, TracePoint#disable... -
TracePoint
. new(*events) {|obj| . . . } -> TracePoint (25.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
# defined _ class -> Class | module (21.0) -
メソッドを定義したクラスかモジュールを返します。
...定義したクラスかモジュールを返します。
//emlist[例][ruby]{
class C; def foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end.enable do
C.new.foo
end
//}
メソッドがモジュールで定義されていた場合も(include に関係なく)モ......end; end
class C; include M; end;
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => M
end.enable do
C.new.foo
end
//}
[注意] 特異メソッドを実行した場合は TracePoint#defined_class は特異クラ
スを返します。また、Kernel.#set_trace_func の 6 番目のブ......く元のクラスを返します。
//emlist[例][ruby]{
class C; def self.foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => #<Class:C>
end.enable do
C.foo
end
//}
Kernel.#set_trace_func と TracePoint の上記の差分に注意して
ください。
@see 50864... -
TracePoint
# disable -> bool (15.0) -
self のトレースを無効にします。
...。
実行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => true
trace.disable # => false (実行前の状態)
trace.enabled? # => false
trace......trace.enabled? # => true
trace.disable do
trace.enabled? # => false
end
trace.enabled? # => true
//}
[注意] イベントフックのためのメソッドに、ブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
trace.enable { p t......race.lineno }
# => RuntimeError: access from outside
@see TracePoint#enable, TracePoint#enabled?... -
TracePoint
# disable { . . . } -> object (15.0) -
self のトレースを無効にします。
...。
実行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => true
trace.disable # => false (実行前の状態)
trace.enabled? # => false
trace......trace.enabled? # => true
trace.disable do
trace.enabled? # => false
end
trace.enabled? # => true
//}
[注意] イベントフックのためのメソッドに、ブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
trace.enable { p t......race.lineno }
# => RuntimeError: access from outside
@see TracePoint#enable, TracePoint#enabled?... -
TracePoint
# binding -> Binding (9.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
# binding -> Binding | nil (9.0) -
発生したイベントによって生成された Binding オブジェクトを返します。
...は binding を生成しないため、
:c_call および :c_return イベントに対しては nil を返すことに注意してください。
//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
# callee _ id -> Symbol | nil (9.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 (9.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_compiled イベントのための...