class Rails::BacktraceCleaner

:nodoc:

def clean(backtrace, kind = :silent)

def clean(backtrace, kind = :silent)
  kind = nil if ENV["BACKTRACE"]
  super(backtrace, kind)
end

def clean_frame(frame, kind = :silent)

def clean_frame(frame, kind = :silent)
  kind = nil if ENV["BACKTRACE"]
  super(frame, kind)
end

def initialize

def initialize
  super
  add_filter do |line|
    # We may be called before Rails.root is assigned.
    # When that happens we fallback to not truncating.
    @root ||= Rails.root && "#{Rails.root}/"
    @root && line.start_with?(@root) ? line.from(@root.size) : line
  end
  add_filter do |line|
    if RENDER_TEMPLATE_PATTERN.match?(line)
      line.sub(RENDER_TEMPLATE_PATTERN, "")
    else
      line
    end
  end
  add_silencer { |line| !APP_DIRS_PATTERN.match?(line) }
end