るりまサーチ

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

別のキーワード

  1. tracepoint enable
  2. tracepoint disable
  3. _builtin tracepoint
  4. tracepoint lineno
  5. tracepoint binding

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

TracePoint#lineno -> Integer (39113.0)

発生したイベントの行番号を返します。

...発生したイベントの行番号を返します。

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

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

TracePoint (38054.0)

Kernel.#set_trace_func と同様の機能をオブジェクト指向的な API で 提供するクラスです。

...集する][ruby]{
trace = TracePoint.new(:raise) do |tp|
p [tp.lineno, tp.event, tp.raised_exception]
end
# => #<TracePoint:0x007f786a452448>

trace.enable
# => false

0 / 0
# => [5, :raise, #<ZeroDivisionError: divided by 0>]
//}

TracePoint
.new または、TracePoint.trace で指定したブロ...
...トの詳細については、TracePoint.new を参照してくださ
い。

=== 参考

* Ruby VM アドベントカレンダー #12 TracePoint の紹介 (1): https://www.atdot.net/~ko1/diary/201212.html#d12
* Ruby VM アドベントカレンダー #13 TracePoint の紹介 (2): https://www.atdot...
....net/~ko1/diary/201212.html#d13
* Ruby VM アドベントカレンダー #14 TracePoint の紹介 (3): https://www.atdot.net/~ko1/diary/201212.html#d14...

TracePoint.new(*events) {|obj| ... } -> TracePoint (21181.0)

新しい TracePoint オブジェクトを作成して返します。トレースを有効 にするには TracePoint#enable を実行してください。

...新しい TracePoint オブジェクトを作成して返します。トレースを有効
にするには TracePoint#enable を実行してください。

//emlist[例:irb で実行した場合][ruby]{
trace = TracePoint.new(:call) do |tp|
p [tp.lineno, tp.defined_class, tp.method_id, tp.even...
...t]
end
# => #<TracePoint:0x007f17372cdb20>

trace.enable
# => false

puts "Hello, TracePoint!"
# ...
# [69, IRB::Notifier::AbstractNotifier, :printf, :call]
# ...
//}

トレースを無効にするには TracePoint#disable を実行してください。

//emlist[][ruby]{
trace.disable
//}

@param...
...ベントに関連しない情報を取得するメソッドを実行した場合には
RuntimeError が発生します。

//emlist[例][ruby]{
TracePoint
.trace(:line) do |tp|
p tp.raised_exception
end
# => RuntimeError: 'raised_exception' not supported by this event
//}

イベントフック...

TracePoint.trace(*events) {|obj| ... } -> TracePoint (21157.0)

新しい TracePoint オブジェクトを作成して自動的にトレースを開始し ます。TracePoint.new のコンビニエンスメソッドです。

...新しい TracePoint オブジェクトを作成して自動的にトレースを開始し
ます。TracePoint.new のコンビニエンスメソッドです。

@param events トレースするイベントを String か Symbol で任
意の数指定します。指定できる値に...
...ついては
TracePoint
.new を参照してください。

//emlist[例][ruby]{
trace = TracePoint.trace(:call) { |tp| [tp.lineno, tp.event] }
# => #<TracePoint:0x007f786a452448>

trace.enabled? # => true
//}

@raise ThreadError ブロックを指定しなかった場合に発生し...

TracePoint#disable -> bool (21024.0)

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

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

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

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

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

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

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

絞り込み条件を変える

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

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

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

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

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

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

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

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

TracePoint#enable -> bool (21024.0)

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

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

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

//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行...
...イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

//emlist[例][ruby]{
trace.enable { p trace.lineno }
# => RuntimeError: access from outside
//}

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

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

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

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

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

//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行...
...イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

//emlist[例][ruby]{
trace.enable { p trace.lineno }
# => RuntimeError: access from outside
//}

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

NEWS for Ruby 2.5.0 (30.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...> (counter) } }
//}
* jump base と jump target にはフォーマットがあります:
//emlist{
[type, unique-id, start lineno, start column, end lineno, end column]
//}
* 例えば [:if, 0, 2, 1, 6, 4] は、if式が2行目の1桁目から6行目の4桁目まで、と読みます...
...key) => (counter) }
//}
* メソッドキーにはフォーマットがあります:
//emlist{
[class, method-name, start lineno, start column, end lineno, end column]
//}
* 例えば [Object, :foo, 1, 0, 7, 3] は Object#foo は1行目の0桁目から7行目の3桁目までで定...
...c allocation というテクニックでブロックをメソッドの引数として渡したときの性能が向上しました
14045

* TracePointのためにtrace命令の変わりに命令の動的書き換えを使用するようにしました
14104

* ERB がテンプレート...

NEWS for Ruby 2.0.0 (24.0)

NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ence#absolute_path,
RubyVM::InstructionSequence#label,
RubyVM::InstructionSequence#base_label,
RubyVM::InstructionSequence#first_lineno to retrieve information from where
the instruction sequence was defined.
* スタックの使用量を指定するための環境変数...
...ThreadError を発生させます

* Time
* 返り値変更:
* Time#to_s now returns US-ASCII encoding instead of BINARY.

* TracePoint
* new class. This class is replacement of set_trace_func.
Easy to use and efficient implementation.

* toplevel
* added method:...
...のためまだサポートしています。
//emlist{
str.lines.with_index(1) {|line, lineno| ... } # str.lines が配列を返すのでもう動かない
str.each_line.with_index(1) {|line, lineno| ... } # このように each_line に置き換える
//}

* IO#lines, IO#chars, IO#codepo...

絞り込み条件を変える

<< 1 2 > >>