method

__enable

Importance_2
v2_6_3 - Show latest stable - 0 notes - Class: TracePoint
  • 1_8_6_287
  • 1_8_7_72
  • 1_8_7_330
  • 1_9_1_378
  • 1_9_2_180
  • 1_9_3_125
  • 1_9_3_392
  • 2_1_10
  • 2_2_9
  • 2_4_6
  • 2_5_5
  • 2_6_3 (0)
  • What's this?
__enable(p1, p2) public

Activates the trace

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

trace.enabled?  #=> false
trace.enable    #=> false (previous state)
                #   trace is enabled
trace.enabled?  #=> true
trace.enable    #=> true (previous state)
                #   trace is still enabled

If a block is given, the trace will only be enabled within the scope of the block.

trace.enabled?
#=> false

trace.enable do
    trace.enabled?
    # only enabled for this block
end

trace.enabled?
#=> false

Note: You cannot access event hooks within the block.

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