るりまサーチ

最速Rubyリファレンスマニュアル検索!
204件ヒット [1-100件を表示] (0.024秒)
トップページ > クエリ:tr[x] > クエリ:binding[x]

別のキーワード

  1. matrix tr
  2. string tr
  3. string tr!
  4. string tr_s
  5. string tr_s!

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 > >>

tracer (26006.0)

実行トレース出力をとる機能を提供します。

...ruby -rtracer hoge.rb

もうひとつはソースからrequireする方法です。

require 'tracer'

とした後

Tr
acer.on

によりトレース出力を有効にします。

Tr
acer.off

によりトレース出力を無効にします。

また、ブロック付きで Tracer.on...
...tracer'

class Hoge
def Hoge.fuga(i)
"fuga #{i}"
end
end

Tr
acer.add_filter {|event, file, line, id, binding, klass|
event =~ /line/ and klass.to_s =~ /hoge/i
}
Tr
acer.on
for i in 0..3
puts Hoge.fuga(i) if i % 3 == 0
end
Tr
acer.off

=== SEE ALSO

Kernel.#set_tr...

TracePoint#binding -> Binding | nil (21230.0)

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

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

C で記述されたメソッドは binding を生成しないため、
:c_call および :c_return イベントに対しては nil を返すことに注意してください。

//emlist[例][ruby]{
def foo(ret)
ret
end
tr
ace = TracePoint.ne...
...w(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
tr
ace.enable
foo 1
//}...

TracePoint#binding -> Binding (21224.0)

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

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


//emlist[例][ruby]{
def foo(ret)
ret
end
tr
ace = TracePoint.new(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
tr
ace.enable
foo 1
//}...

Tracer#trace_func(event, file, line, id, binding, klass, *) -> object | nil (9201.0)

@todo

@todo

Binding#source_location -> [String, Integer] (9106.0)

self の Ruby のソースファイル名と行番号を返します。

...self の Ruby のソースファイル名と行番号を返します。

d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。

//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//}...

絞り込み条件を変える

IRB::Frame#trace_func(event, file, line, id, binding) -> Binding (6302.0)

ライブラリ内部で使用します。

ライブラリ内部で使用します。

Thread#backtrace -> [String] | nil (6206.0)

スレッドの現在のバックトレースを返します。

...def m1
sleep 5
end
def m2
m1
end
end

th = Thread.new {C1.new.m2; Thread.stop}
th.backtrace
# => [
# [0] "(irb):3:in `sleep'",
# [1] "(irb):3:in `m1'",
# [2] "(irb):6:in `m2'",
# [3] "(irb):10:in `block in irb_binding'"
# ]

th.kill
th.backtrace # => nil
//}...

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

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

...す。

標準添付の debug、tracer、
profile はこの組み込み関数を利用して実現されています。

=== ブロックパラメータの意味

渡す Proc オブジェクトのパラメータは
//emlist[][ruby]{
proc{|event, file, line, id, binding, klass| "..." }
//}
で、意...
...び出されたメソッドを表す Symbol オブジェクト。
トップレベルでは nil。
//}
: binding
実行中のプログラムのコンテキストを表す Binding オブジェクト。

: klass
event に応じ、以下のものが渡されます。
第四ブロック引数...
...

//emlist[例][ruby]{
set_trace_func lambda {|*arg|
p arg
}
class Foo
end
43.to_s

# ----結果----
# ["c-return", "..", 1, :set_trace_func, #<Binding:0xf6ceb8>, Kernel]
# ["line", "..", 4, nil, #<Binding:0x10cbcd8>, nil]
# ["c-call", "..", 4, :inherited, #<Binding:0x10cba98>, Class]
# ["c-ret...

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

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

...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]
# => ["c-call", "example.rb", 2, :inherited, #<Binding:0x00007fc8de886770>, Clas...
...turn", "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-c...
..."example.rb", 4, :to_s, #<Binding:0x00007fc8de894a50>, Integer]
# => ["line", "example.rb", 5, nil, #<Binding:0x00007fc8de967b08>, nil]
# => ["c-call", "example.rb", 5, :current, #<Binding:0x00007fc8de967798>, Thread]
# => ["c-return", "example.rb", 5, :current, #<Binding:0x00007fc8de9673b0>, Threa...

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

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

...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, :inherited, #<Binding:0x00007f98e1087448>, Class]
# => ["c-return", "example.rb", 4, :inherited, #<Binding:0x000...
...=> ["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]
//}

@see Thread#set_trace_func Kernel.#set_trace_func...

絞り込み条件を変える

<< 1 2 3 > >>