module RSpec::Core::BacktraceFormatter

def backtrace_line(line)

def backtrace_line(line)
  return nil if RSpec.configuration.backtrace_formatter.exclude?(line)
  RSpec::Core::Metadata::relative_path(line)
rescue SecurityError
  nil
end

def format_backtrace(backtrace, options = {})

def format_backtrace(backtrace, options = {})
  return "" unless backtrace
  return backtrace if options[:full_backtrace] == true
  if at_exit_index = backtrace.index(RSpec::Core::Runner::AT_EXIT_HOOK_BACKTRACE_LINE)
    backtrace = backtrace[0, at_exit_index]
  end
  cleansed = backtrace.map { |line| backtrace_line(line) }.compact
  cleansed.empty? ? backtrace : cleansed
end