instance method
TracePoint#disable
() -> bool
[T] () { () -> T } -> T
trace.disable → true or false
trace.disable { block } → obj
trace_point.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/trace_point.rb, line 297
def disable
Primitive.attr! :use_block
Primitive.tracepoint_disable_m
end
Deactivates the trace.
Returns true if the trace was enabled. Returns false if the trace was disabled.
Example
trace.enabled? #=> true trace.disable #=> true (previous status) trace.enabled? #=> false trace.disable #=> false
If a block is given, the trace will only be disabled within the scope of the block.
Example
trace.enabled? #=> true trace.disable do trace.enabled? # Only disabled for this block end trace.enabled? #=> true
Note: You cannot access event hooks within the block.
Example
trace.disable { p tp.lineno } #=> RuntimeError: access from outside