55件ヒット
[1-55件を表示]
(0.129秒)
キーワード
- Frame (11)
- Location (11)
- TracePoint (11)
- Tracer (11)
検索結果
-
Net
:: HTTP :: Trace (24017.0) -
HTTP の TRACE リクエストを表すクラスです。
...HTTP の TRACE リクエストを表すクラスです。... -
TracePoint (12041.0)
-
Kernel.#set_trace_func と同様の機能をオブジェクト指向的な API で 提供するクラスです。
...trace_func と同様の機能をオブジェクト指向的な API で
提供するクラスです。
//emlist[例:例外に関する情報を収集する][ruby]{
trace = TracePoint.new(:raise) do |tp|
p [tp.lineno, tp.event, tp.raised_exception]
end
# => #<TracePoint:0x007f786a452448>
trace.ena......ble
# => false
0 / 0
# => [5, :raise, #<ZeroDivisionError: divided by 0>]
//}
TracePoint.new または、TracePoint.trace で指定したブロック
は、メソッドの引数(上記の例では :raise)に対応するイベントが発生した時に
呼び出されます。
発生するイベ......ては、TracePoint.new を参照してくださ
い。
=== 参考
* Ruby VM アドベントカレンダー #12 TracePoint の紹介 (1): https://www.atdot.net/~ko1/diary/201212.html#d12
* Ruby VM アドベントカレンダー #13 TracePoint の紹介 (2): https://www.atdot.net/~ko1/diary/20121... -
Tracer (12001.0)
-
実行トレース出力をとる機能を提供するクラスです。
実行トレース出力をとる機能を提供するクラスです。 -
Thread
:: Backtrace :: Location (9019.0) -
Ruby のフレームを表すクラスです。
...#caller_locations から生成されます。
//emlist[例1][ruby]{
# caller_locations.rb
def a(skip)
caller_locations(skip)
end
def b(skip)
a(skip)
end
def c(skip)
b(skip)
end
c(0..2).map do |call|
puts call.to_s
end
//}
例1の実行結果:
caller_locations.rb:2:in `a'
caller_locat......:in `b'
caller_locations.rb:8:in `c'
//emlist[例2][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
//}
例2の実行結果:
init.rb:4:in `initialize'
in......it.rb:8:in `new'
init.rb:8:in `<main>'
=== 参考
* Ruby VM アドベントカレンダー #4 vm_backtrace.c: https://www.atdot.net/~ko1/diary/201212.html#d4... -
IRB
:: Frame (6007.0) -
現在実行中のフレーム情報を取り扱うためのクラスです。
...現在実行中のフレーム情報を取り扱うためのクラスです。
[注]
set_trace_func を用いて Ruby の実行をトレースしています。
マルチスレッドには対応していません。...