るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dsa p
  5. dsa p=

ライブラリ

キーワード

検索結果

<< 1 2 > >>

TracePoint#raised_exception -> Exception (9320.0)

発生した例外を返します。

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

//emlist[例][ruby]{
trace
= TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided by 0>
end
trace
.enable
begin
0/0
rescue
end
//}...

TracePoint#inspect -> String (9220.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#path -> String (9220.0)

イベントが発生したファイルのパスを返します。

...トが発生したファイルのパスを返します。

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

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

TracePoint#eval_script -> String | nil (9208.0)

script_compiledイベント発生時にコンパイルされたソースコードを返します。 ファイルから読み込んだ場合は、nilを返します。

...script_compiledイベント発生時にコンパイルされたソースコードを返します。
ファイルから読み込んだ場合は、nilを返します。

//emlist[例][ruby]{
TracePoint
.new(:script_compiled) do |tp|
p
tp.eval_script # => "puts 'hello'"
end.enable do
eval("puts 'he...
...llo'")
end
//}

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

TracePoint#parameters -> [object] (9208.0)

現在のフックが属するメソッドまたはブロックのパラメータ定義を返します。 フォーマットは Method#parameters と同じです。

...parameters と同じです。

@raise RuntimeError :call、:return、:b_call、:b_return、:c_call、:c_return
イベントのためのイベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(a, b = 2)
end
TracePoint
.new(:call) do |tp...
...|
p
tp.parameters # => a], [:opt, :b
end.enable do
foo(1)
end
//}

@see Method#parameters, UnboundMethod#parameters, Proc#parameters...

絞り込み条件を変える

TracePoint#disable -> bool (6168.0)

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

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

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

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

trace
.enabled? # => true
//}

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

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

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

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

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

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

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

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

trace
.enabled? # => true
//}

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

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

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

TracePoint#enable -> bool (6168.0)

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

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

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

# トレースが有効

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

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

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

//emlist[例][ruby]{
trace
.enable...
...=> false

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

trace
.enabled? # => false
//}

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

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

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

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

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

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

# トレースが有効

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

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

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

//emlist[例][ruby]{
trace
.enable...
...=> false

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

trace
.enabled? # => false
//}

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

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

TracePoint#defined_class -> Class | module (6156.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...

絞り込み条件を変える

<< 1 2 > >>