class DEBUGGER__::CallTracer

Public Instance Methods

setup() click to toggle source
# File debug-1.4.0/lib/debug/tracer.rb, line 123
def setup
  @tracer = TracePoint.new(:a_call, :a_return){|tp|
    next if skip?(tp)

    depth = caller.size
    sp = ' ' * depth

    call_identifier_str =
      if tp.defined_class
        minfo(tp)
      else
        "block"
      end

    call_identifier_str = colorize_blue(call_identifier_str)

    case tp.event
    when :call, :c_call, :b_call
      depth += 1 if tp.event == :c_call
      out tp, ">#{sp}#{call_identifier_str}", depth
    when :return, :c_return, :b_return
      depth += 1 if tp.event == :c_return
      return_str = colorize_magenta(DEBUGGER__.safe_inspect(tp.return_value, short: true))
      out tp, "<#{sp}#{call_identifier_str} #=> #{return_str}", depth
    end
  }
end
skip_with_pattern?(tp) click to toggle source
Calls superclass method DEBUGGER__::Tracer#skip_with_pattern?
# File debug-1.4.0/lib/debug/tracer.rb, line 151
def skip_with_pattern?(tp)
  super && !tp.method_id&.match?(@pattern)
end