Method: Monkey.delete_from_backtrace

Defined in:
lib/monkey.rb

.delete_from_backtrace(error, &block) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/monkey.rb', line 40

def self.delete_from_backtrace(error, &block)
  if error.respond_to? :awesome_backtrace
    # HACK: we rely on the internal data structure, btw
    locations = error.instance_variable_get :@locations
    return unless locations
    locations.reject! { |l| yield l.position }
    error.instance_variable_set :@backtrace, nil
  else
    error.backtrace.reject!(&block)
  end
end