method

disable

Importance_2
Ruby latest stable (v2_5_5) - 0 notes - Class: TracePoint
disable() public

Deactivates the trace

Return true if trace was enabled. Return false if trace was disabled.

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.

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.

trace.disable { p tp.lineno }
#=> RuntimeError: access from outside
Show source
Register or log in to add new notes.