class Protest::Utils::BacktraceFilter

Small utility object to filter an error’s backtrace and remove any mention of Protest’s own files.

Constants

ESCAPE_PATHS

Public Instance Methods

filter_backtrace(backtrace, prefix=nil) click to toggle source

Filter the backtrace, removing any reference to files located in BASE_PATH.

# File lib/protest/utils/backtrace_filter.rb, line 16
def filter_backtrace(backtrace, prefix=nil)
  paths = ESCAPE_PATHS + [prefix].compact
  backtrace.reject do |line|
    file = line.split(":").first
    paths.any? {|path| File.expand_path(file) =~ path }
  end
end