226件ヒット
[101-200件を表示]
(0.051秒)
種類
- インスタンスメソッド (194)
- 特異メソッド (32)
キーワード
- binding (11)
-
callee
_ id (11) -
defined
_ class (11) - disable (22)
- enable (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) - self (11)
- stat (10)
検索結果
先頭5件
-
TracePoint
# inspect -> String (12027.0) -
self の状態を人間に読みやすい文字列にして返します。
...self の状態を人間に読みやすい文字列にして返します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.inspect # "#<TracePoint:call `foo'@/path/to/test.rb:1>"
end
trace.enable
foo 1
//}... -
TracePoint
# method _ id -> Symbol | nil (12027.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
. stat -> object (12025.0) -
TracePoint の内部情報を返します。
...TracePoint の内部情報を返します。
返り値の内容は実装依存です。
将来変更される可能性があります。
このメソッドは TracePoint 自身のデバッグ用です。... -
TracePoint
# binding -> Binding (12021.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 (12021.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
# lineno -> Integer (12021.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
# path -> String (12021.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 (12021.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 (12021.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
# enabled? -> bool (12015.0) -
self のトレースが有効な場合に true を、そうでない場合に false を返しま す。
...self のトレースが有効な場合に true を、そうでない場合に false を返しま
す。
@see TracePoint#enable, TracePoint#disable... -
TracePoint
# self -> object (12015.0) -
イベントを発生させたオブジェクトを返します。
...イベントを発生させたオブジェクトを返します。
以下のようにする事で同じ値を取得できます。
//emlist[例][ruby]{
trace.binding.eval('self')
//}
@see TracePoint#binding...