Sha256: b1f0073c5f4c24062f19c9cbdb4a1677a19ca39c56cf886cdb8c4706116bfb06

Contents?: true

Size: 736 Bytes

Versions: 74

Compression:

Stored size: 736 Bytes

Contents

# frozen_string_literal: true

require "active_support/backtrace_cleaner"
require "active_support/core_ext/string/access"

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

    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
  end
end

Version data entries

74 entries across 70 versions & 6 rubygems

Version Path
railties-7.0.8.6 lib/rails/backtrace_cleaner.rb
railties-6.1.7.10 lib/rails/backtrace_cleaner.rb
railties-6.1.7.9 lib/rails/backtrace_cleaner.rb
railties-7.0.8.5 lib/rails/backtrace_cleaner.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/railties-7.0.8.4/lib/rails/backtrace_cleaner.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/railties-7.0.5.1/lib/rails/backtrace_cleaner.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/railties-7.0.5.1/lib/rails/backtrace_cleaner.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/railties-7.0.5.1/lib/rails/backtrace_cleaner.rb
railties-7.0.8.4 lib/rails/backtrace_cleaner.rb
railties-6.1.7.8 lib/rails/backtrace_cleaner.rb
railties-7.0.8.1 lib/rails/backtrace_cleaner.rb
railties-6.1.7.7 lib/rails/backtrace_cleaner.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/railties-7.0.3.1/lib/rails/backtrace_cleaner.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/railties-7.0.2.3/lib/rails/backtrace_cleaner.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/backtrace_cleaner.rb
railties-7.0.8 lib/rails/backtrace_cleaner.rb
railties-7.0.7.2 lib/rails/backtrace_cleaner.rb
railties-6.1.7.6 lib/rails/backtrace_cleaner.rb
railties-7.0.7.1 lib/rails/backtrace_cleaner.rb
railties-6.1.7.5 lib/rails/backtrace_cleaner.rb