106件ヒット
[1-100件を表示]
(0.032秒)
種類
- インスタンスメソッド (55)
- 特異メソッド (22)
- 文書 (18)
- クラス (11)
ライブラリ
- ビルトイン (88)
クラス
- TracePoint (77)
キーワード
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 5 . 0 (7) - disable (22)
- enable (22)
- new (11)
検索結果
先頭5件
-
TracePoint (44088.0)
-
Kernel.#set_trace_func と同様の機能をオブジェクト指向的な API で 提供するクラスです。
...t_trace_func と同様の機能をオブジェクト指向的な API で
提供するクラスです。
//emlist[例:例外に関する情報を収集する][ruby]{
trace = TracePoint.new(:raise) do |tp|
p [tp.lineno, tp.event, tp.raised_exception]
end
# => #<TracePoint:0x007f786a452448>
trace.e......divided by 0>]
//}
TracePoint.new または、TracePoint.trace で指定したブロック
は、メソッドの引数(上記の例では :raise)に対応するイベントが発生した時に
呼び出されます。
発生するイベントの詳細については、TracePoint.new を参照し......トカレンダー #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://w... -
TracePoint
. trace(*events) {|obj| . . . } -> TracePoint (42376.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
# lineno -> Integer (42125.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
. new(*events) {|obj| . . . } -> TracePoint (24311.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
# disable -> bool (24084.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 (24084.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 (24084.0) -
self のトレースを有効にします。
...前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行前の状態)
# トレースが有効
trace.enabled......# => true
trace.enable # => true (実行前の状態)
# 引き続きトレースが有効
//}
ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。
//emlist[例][ruby]{
trace.enabled?......e
trace.enable do
trace.enabled? # => true
end
trace.enabled? # => false
//}
[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
//emlist[例][ruby]{
trace.enable { p trace.lineno... -
TracePoint
# enable { . . . } -> object (24084.0) -
self のトレースを有効にします。
...前の TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)
//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行前の状態)
# トレースが有効
trace.enabled......# => true
trace.enable # => true (実行前の状態)
# 引き続きトレースが有効
//}
ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。
//emlist[例][ruby]{
trace.enabled?......e
trace.enable do
trace.enabled? # => true
end
trace.enabled? # => false
//}
[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。
//emlist[例][ruby]{
trace.enable { p trace.lineno... -
NEWS for Ruby 2
. 5 . 0 (42.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...code character properties
* RubyVM::InstructionSequence
* RubyVM::InstructionSequence#each_child を追加
* RubyVM::InstructionSequence#trace_points を追加
* String
* String#-@ はフリーズされていない文字列の重複を排除します。
互換性のため、......> (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桁目まで、と読みます......ion というテクニックでブロックをメソッドの引数として渡したときの性能が向上しました
14045
* TracePointのためにtrace命令の変わりに命令の動的書き換えを使用するようにしました
14104
* ERB がテンプレートから生... -
NEWS for Ruby 2
. 0 . 0 (30.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.
* スタックの使用量を指定するための環境変数......andling of exceptions
* 追加: Thread#backtrace_locations Kernel#caller_locations に似た情報を返します
* 新規クラス: Thread::Backtrace::Location to hold backtrace location
information. These are returned by Thread#backtrace_locations and
Kernel#caller_locations......させます
* 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:
* added main.define_m...