colorize(str, color)
click to toggle source
def colorize(str, color)
if @into
str
else
super
end
end
description()
click to toggle source
disable()
click to toggle source
def disable
@tracer.disable
end
enable()
click to toggle source
def enable
@tracer.enable
end
minfo(tp)
click to toggle source
def minfo tp
return "block{}" if tp.event == :b_call
klass = tp.defined_class
if klass.singleton_class?
"#{tp.self}.#{tp.method_id}"
else
"#{klass}\##{tp.method_id}"
end
end
out(tp, msg = nil, depth = caller.size - 1)
click to toggle source
def out tp, msg = nil, depth = caller.size - 1
location_str = colorize("#{tp.path}:#{tp.lineno}", [:GREEN])
buff = "#{header(depth)}#{msg} at #{location_str}"
if false
ThreadClient.current.on_trace self.object_id, buff
else
@output.puts buff
end
end
puts(msg)
click to toggle source
def puts msg
@output.puts msg
end
skip?(tp)
click to toggle source
def skip? tp
if tp.path.start_with?(__dir__) ||
tp.path.start_with?('<internal:') ||
ThreadClient.current.management? ||
skip_path?(tp.path) ||
skip_with_pattern?(tp)
true
else
false
end
end
skip_with_pattern?(tp)
click to toggle source
def skip_with_pattern?(tp)
@pattern && !tp.path.match?(@pattern)
end
to_s()
click to toggle source
def to_s
s = "#{@name}#{description} (#{@tracer.enabled? ? 'enabled' : 'disabled'})"
s += " with pattern #{@pattern.inspect}" if @pattern
s += " into: #{@into}" if @into
s
end