enable

trace.enable â true or false
trace.enable { block } â obj
Instance Public methods

Activates the trace

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

1
2
3
4
5
6
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.

1
2
3
4
5
6
7
8
9
10
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.

1
2
trace.enable { p tp.lineno }
#=> RuntimeError: access from outside
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.