class Quails::BacktraceCleaner
Constants
- APP_DIRS_PATTERN
- DOT_SLASH
- EMPTY_STRING
- RENDER_TEMPLATE_PATTERN
- SLASH
Public Class Methods
new()
click to toggle source
Calls superclass method
ActiveSupport::BacktraceCleaner::new
# File railties/lib/rails/backtrace_cleaner.rb, line 13 def initialize super @root = "#{Quails.root}/".freeze add_filter { |line| line.sub(@root, EMPTY_STRING) } add_filter { |line| line.sub(RENDER_TEMPLATE_PATTERN, EMPTY_STRING) } add_filter { |line| line.sub(DOT_SLASH, SLASH) } # for tests add_gem_filters add_silencer { |line| !APP_DIRS_PATTERN.match?(line) } end
Private Instance Methods
add_gem_filters()
click to toggle source
# File railties/lib/rails/backtrace_cleaner.rb, line 25 def add_gem_filters gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) } return if gems_paths.empty? gems_regexp = %r{(#{gems_paths.join('|')})/gems/([^/]+)-([\w.]+)/(.*)} gems_result = '\2 (\3) \4'.freeze add_filter { |line| line.sub(gems_regexp, gems_result) } end