class HyperTrace::Config

Attributes

klass[R]

Public Class Methods

new(klass, instrument_class, opts, &block) click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 21
def initialize(klass, instrument_class, opts, &block)
  @klass = klass
  @opts = {}
  @instrument_class = instrument_class
  [:break_on_enter?, :break_on_entry?, :break_on_exit?, :break_on_enter, :break_on_entry, :break_on_exit, :instrument].each do |method|
    send(method, opts[method]) if opts[method]
  end unless opts[:instrument] == :none
  instance_eval(&block) if block
end

Public Instance Methods

[](opt) click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 60
def [](opt)
  @opts[opt]
end
break_on_enter(methods) click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 45
def break_on_enter(methods)
  [*methods].each { |method| break_on_enter?(method) { true } }
end
Also aliased as: break_on_entry, break_on_entry?
break_on_enter?(method, &block) click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 54
def break_on_enter?(method, &block)
  @opts[:break_on_enter?] ||= {}
  @opts[:break_on_enter?][method] = block
  instrument(method)
end
break_on_entry(methods)
Alias for: break_on_enter
break_on_entry?(methods)
Alias for: break_on_enter
break_on_exit(methods) click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 42
def break_on_exit(methods)
  [*methods].each { |method| break_on_exit?(method) { true } }
end
break_on_exit?(method, &block) click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 49
def break_on_exit?(method, &block)
  @opts[:break_on_exit?] ||= {}
  @opts[:break_on_exit?][method] = block
  instrument(method)
end
hypertrace_class_exclusions() click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 63
def hypertrace_class_exclusions
  if klass.respond_to? :hypertrace_class_exclusions
    klass.hypertrace_class_exclusions
  else
    []
  end
end
hypertrace_exclusions() click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 70
def hypertrace_exclusions
  if klass.respond_to? :hypertrace_exclusions
    klass.hypertrace_exclusions
  else
    []
  end
end
instrument(opt) click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 34
def instrument(opt)
  return if @opts[:instrument] == :all
  if opt == :all
    @opts[:instrument] = :all
  else
    @opts[:instrument] = [*opt, *@opts[:instrument]]
  end
end
instrument_class?() click to toggle source
# File lib/hyper_trace/hyper_trace.rb, line 30
def instrument_class?
  @instrument_class
end