Class: Rails::BacktraceCleaner

Inherits:
ActiveSupport::BacktraceCleaner show all
Defined in:
railties/lib/rails/backtrace_cleaner.rb

Overview

:nodoc:

Constant Summary collapse

APP_DIRS_PATTERN =
/\A(?:\.\/)?(?:app|config|lib|test|\(\w*\))/
RENDER_TEMPLATE_PATTERN =
/:in `.*_\w+_{2,3}\d+_\d+'/

Instance Method Summary collapse

Methods inherited from ActiveSupport::BacktraceCleaner

#add_filter, #add_silencer, #clean, #remove_filters!, #remove_silencers!

Constructor Details

#initializeBacktraceCleaner

Returns a new instance of BacktraceCleaner.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'railties/lib/rails/backtrace_cleaner.rb', line 11

def initialize
  super
  @root = "#{Rails.root}/"
  add_filter do |line|
    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