Skip to content
class method

TracePoint.trace

(*::_ToSym events) { (instance tp) -> void } -> instance
TracePoint.trace(*events) { |tp| block } → obj

A convenience method for TracePoint.new that activates the trace automatically.

Example
trace = TracePoint.trace(:call) { |tp| [tp.lineno, tp.event] }
#=> #<TracePoint:enabled>

trace.enabled?  #=> true
See also .stat #binding .new #callee_id also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0