るりまサーチ

最速Rubyリファレンスマニュアル検索!
194件ヒット [1-100件を表示] (0.023秒)
トップページ > クラス:TracePoint[x] > クエリ:tracepoint[x] > クエリ:trace[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. tracepoint enable
  2. tracepoint disable
  3. _builtin tracepoint
  4. tracepoint path

ライブラリ

キーワード

検索結果

<< 1 2 > >>

TracePoint#disable -> bool (12080.0)

self のトレースを無効にします。

...行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace
.enabled? # => true
trace
.disable # => false (実行前の状態)
trace
.enabled? # => false
trace
.disable...
...[ruby]{
trace
.enabled? # => true

trace
.disable do
trace
.enabled? # => false
end

trace
.enabled? # => true
//}

[注意] イベントフックのためのメソッドに、ブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

trace
.enabl...
...e { p trace.lineno }
# => RuntimeError: access from outside

@see TracePoint#enable, TracePoint#enabled?...

TracePoint#disable { ... } -> object (12080.0)

self のトレースを無効にします。

...行前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace
.enabled? # => true
trace
.disable # => false (実行前の状態)
trace
.enabled? # => false
trace
.disable...
...[ruby]{
trace
.enabled? # => true

trace
.disable do
trace
.enabled? # => false
end

trace
.enabled? # => true
//}

[注意] イベントフックのためのメソッドに、ブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

trace
.enabl...
...e { p trace.lineno }
# => RuntimeError: access from outside

@see TracePoint#enable, TracePoint#enabled?...

TracePoint#enable -> bool (12080.0)

self のトレースを有効にします。

...前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace
.enabled? # => false
trace
.enable # => false (実行前の状態)

# トレースが有効

trace
.enabled...
...# => true
trace
.enable # => true (実行前の状態)

# 引き続きトレースが有効
//}

ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。

//emlist[例][ruby]{
trace
.enabled?...
...alse

trace
.enable do
trace
.enabled? # => true
end

trace
.enabled? # => false
//}

[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

//emlist[例][ruby]{
trace
.enable { p trace.lin...

TracePoint#enable { ... } -> object (12080.0)

self のトレースを有効にします。

...前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace
.enabled? # => false
trace
.enable # => false (実行前の状態)

# トレースが有効

trace
.enabled...
...# => true
trace
.enable # => true (実行前の状態)

# 引き続きトレースが有効
//}

ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。

//emlist[例][ruby]{
trace
.enabled?...
...alse

trace
.enable do
trace
.enabled? # => true
end

trace
.enabled? # => false
//}

[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

//emlist[例][ruby]{
trace
.enable { p trace.lin...

TracePoint#defined_class -> Class | module (12062.0)

メソッドを定義したクラスかモジュールを返します。

...メソッドを定義したクラスかモジュールを返します。

//emlist[例][ruby]{
class C; def foo; end; end
trace
= TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end.enable do
C.new.foo
end
//}

メソッドがモジュールで定義されていた場合も(include に...
...class C; include M; end;
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => M
end.enable do
C.new.foo
end
//}

[注意] 特異メソッドを実行した場合は TracePoint#defined_class は特異クラ
スを返します。また、Kernel.#set_trace_func の 6 番目のブロック...
...く元のクラスを返します。

//emlist[例][ruby]{
class C; def self.foo; end; end
trace
= TracePoint.new(:call) do |tp|
p tp.defined_class # => #<Class:C>
end.enable do
C.foo
end
//}

Kernel.#set_trace_func と TracePoint の上記の差分に注意して
ください。

@see 50864...

絞り込み条件を変える

TracePoint#callee_id -> Symbol | nil (12026.0)

イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。

...した場合に発生します。

//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end

trace
= TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
end
trace
.enable do
C.new.alias_name
end
//}

@see TracePoint#method_id...

TracePoint#event -> Symbol (12026.0)

発生したイベントの種類を Symbol で返します。

...細については、TracePoint.new を参照してくださ
い。

@raise RuntimeError イベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace
= TracePoint.new(:call, :return) do |tp|
p tp.event
end
trace
.enable
foo 1
# => :call...

TracePoint#inspect -> String (12026.0)

self の状態を人間に読みやすい文字列にして返します。

...self の状態を人間に読みやすい文字列にして返します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace
= TracePoint.new(:call) do |tp|
p tp.inspect # "#<TracePoint:call `foo'@/path/to/test.rb:1>"
end
trace
.enable
foo 1
//}...

TracePoint#method_id -> Symbol | nil (12026.0)

イベントが発生したメソッドの定義時の名前を Symbol で返します。 トップレベルであった場合は nil を返します。

...した場合に発生します。

//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end

trace
= TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
end
trace
.enable do
C.new.alias_name
end
//}

@see TracePoint#callee_id...

TracePoint#binding -> Binding (12020.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
//}...

絞り込み条件を変える

<< 1 2 > >>