End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
TracePoint#disable
trace.disable → true or false
trace.disable { block } → obj
trace_point.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/trace_point.rb, line 247
def disable
Primitive.tracepoint_disable_m
end
Deactivates the trace
Return true if trace was enabled. Return false if 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 disable 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