るりまサーチ

最速Rubyリファレンスマニュアル検索!
62件ヒット [1-62件を表示] (0.020秒)

別のキーワード

  1. _builtin call
  2. method call
  3. fiddle call
  4. continuation call
  5. formatter call

クラス

モジュール

検索結果

TracePoint#binding -> Binding | nil (18244.0)

発生したイベントによって生成された Binding オブジェクトを返します。

... Binding オブジェクトを返します。

C で記述されたメソッドは 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#binding -> Binding (18232.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
//}...

Kernel.#set_trace_func(proc) -> Proc (122.0)

Ruby インタプリタのイベントをトレースする Proc オブジェクトとして 指定された proc を登録します。 nil を指定するとトレースがオフになります。

...タは
//emlist[][ruby]{
proc{|event, file, line, id, binding, klass| "..." }
//}
で、意味は以下の通りです。

: event
実行のタイプを表す、以下のいずれかの文字列。
//emlist{
"line": 式の評価。
"call": メソッドの呼び出し。
"return":...
...メソッド呼び出しからのリターン。
"c-call": Cで記述されたメソッドの呼び出し。
"c-return": Cで記述されたメソッド呼び出しからのリターン。
"class": クラス定義、特異クラス定義、モジュール定義への突入。
"end":...
...ist{
line
最後に呼び出されたメソッドを表す Symbol オブジェクト。
トップレベルでは nil。
call
/return/c-call/c-return
呼び出された/リターンするメソッドを表す Symbol オブジェクト。
class/end
nil。...

Thread#set_trace_func(pr) -> Proc | nil (98.0)

スレッドにトレース用ハンドラを設定します。

..., "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
# => ["c-call", "example.rb", 2, :inherited, #<Binding:0x00007fc8de886770>, Class]
# => ["c-return", "example.rb", 2, :inherited, #<Binding:0x00007fc8de8844e8>, Class]
# => ["class", "example.rb", 2, nil, #<Binding:0x00007fc8de88e830>, nil]...
...["end", "example.rb", 3, nil, #<Binding:0x00007fc8de88d6b0>, nil]
# => ["line", "example.rb", 4, nil, #<Binding:0x00007fc8de88c440>, nil]
# => ["c-call", "example.rb", 4, :to_s, #<Binding:0x00007fc8de896f30>, Integer]
# => ["c-return", "example.rb", 4, :to_s, #<Binding:0x00007fc8de894a50>, Integer]...
...ample.rb", 5, nil, #<Binding:0x00007fc8de967b08>, nil]
# => ["c-call", "example.rb", 5, :current, #<Binding:0x00007fc8de967798>, Thread]
# => ["c-return", "example.rb", 5, :current, #<Binding:0x00007fc8de9673b0>, Thread]
# => ["c-call", "example.rb", 5, :set_trace_func, #<Binding:0x00007fc8de966fc8>...

Thread#add_trace_func(pr) -> Proc (62.0)

スレッドにトレース用ハンドラを追加します。

..., "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "example.rb", 4, :inherited, #<Binding:0x00007f98e1087448>, Class]
# => ["c-return", "example.rb", 4, :inherited, #<Binding:0x00007f98e1085d00>, Class]
# => ["class", "example.rb", 4, nil, #<Binding:0x00007f98e108f210>, nil]...
...["end", "example.rb", 5, nil, #<Binding:0x00007f98e108e5e0>, nil]
# => ["line", "example.rb", 6, nil, #<Binding:0x00007f98e108d4b0>, nil]
# => ["c-call", "example.rb", 6, :to_s, #<Binding:0x00007f98e1097aa0>, Integer]
# => ["c-return", "example.rb", 6, :to_s, #<Binding:0x00007f98e1095cc8>, Integer]...

絞り込み条件を変える

TracePoint#self -> object (26.0)

イベントを発生させたオブジェクトを返します。

...返します。

以下のようにする事で同じ値を取得できます。

なお、self メソッドは binding が nil になる :c_call および :c_return イベントに対しても正しく動作します。

//emlist[例][ruby]{
trace.binding.eval('self')
//}

@see TracePoint#binding...

Thread#report_on_exception -> bool (14.0)

真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...#<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_except...

Thread#report_on_exception=(newstate) (14.0)

真の場合、そのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...#<Thread:0x00007fc3f48c7908@(irb):1 run> terminated with exception (report_on_exception is true):
# Traceback (most recent call last):
# (irb):1:in `block in irb_binding': unhandled exception
# #<Thread:0x00007fc3f48c7908@(irb):1 dead>
b = Thread.new{ Thread.stop; raise }
b.report_on_except...