4件ヒット
[1-4件を表示]
(0.037秒)
種類
- インスタンスメソッド (3)
- クラス (1)
クラス
- Thread (2)
-
Thread
:: Backtrace :: Location (1)
キーワード
- Location (1)
-
add
_ trace _ func (1) -
set
_ trace _ func (1)
検索結果
先頭4件
-
Thread
:: Backtrace :: Location # to _ s -> String (63376.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し
ます。
//emlist[例][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
# => path/to/foo.rb:5:in `initialize'
# path/to/foo... -
Thread
# set _ trace _ func(pr) -> Proc | nil (9097.0) -
スレッドにトレース用ハンドラを設定します。
スレッドにトレース用ハンドラを設定します。
nil を渡すとトレースを解除します。
設定したハンドラを返します。
//emlist[例][ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join
# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
#... -
Thread
# add _ trace _ func(pr) -> Proc (9079.0) -
スレッドにトレース用ハンドラを追加します。
スレッドにトレース用ハンドラを追加します。
追加したハンドラを返します。
@param pr トレースハンドラ(Proc オブジェクト)
//emlist[例][ruby]{
th = Thread.new do
class Trace
end
43.to_s
end
th.add_trace_func lambda {|*arg| p arg }
th.join
# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "example.rb", 4, ... -
Thread
:: Backtrace :: Location (9061.0) -
Ruby のフレームを表すクラスです。
Ruby のフレームを表すクラスです。
Kernel.#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_locations...