4件ヒット
[1-4件を表示]
(0.274秒)
クラス
- Thread (2)
-
Thread
:: Backtrace :: Location (2)
キーワード
-
add
_ trace _ func (1) - inspect (1)
-
set
_ trace _ func (1)
検索結果
先頭4件
-
Thread
:: Backtrace :: Location # to _ s -> String (87331.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 (42493.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 (42439.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 # inspect -> String (33058.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。
//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.inspect
end
# => "path/to/foo.rb:5:in ...