instance method TracePoint#disable

disable -> bool[permalink][rdoc][edit]
disable { ... } -> object

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

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



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

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



trace.enabled?   # => true

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

trace.enabled?   # => true

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

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

[SEE_ALSO] TracePoint#enable, TracePoint#enabled?