Sha256: 35b039e6a315da4ce0a1f138ae1f79b43ddcfd51002d676110dcfb9167fc8154

Contents?: true

Size: 677 Bytes

Versions: 10

Compression:

Stored size: 677 Bytes

Contents

# frozen_string_literal: true

module Airbrake
  module Rails
    # BacktraceCleaner is a wrapper around Rails.backtrace_cleaner.
    class BacktraceCleaner
      # @return [Regexp]
      AIRBRAKE_FRAME_PATTERN = %r{/airbrake/lib/airbrake/}.freeze

      def self.clean(backtrace)
        ::Rails.backtrace_cleaner.clean(backtrace).first(1)
      end
    end
  end
end

if defined?(Rails)
  # Silence own frames to let the cleaner proceed to the next line (and probably
  # find the correct call-site coming from the app code rather this library).
  Rails.backtrace_cleaner.add_silencer do |line|
    line =~ Airbrake::Rails::BacktraceCleaner::AIRBRAKE_FRAME_PATTERN
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
airbrake-13.0.4 lib/airbrake/rails/backtrace_cleaner.rb
airbrake-13.0.3 lib/airbrake/rails/backtrace_cleaner.rb
airbrake-13.0.2 lib/airbrake/rails/backtrace_cleaner.rb
airbrake-13.0.1 lib/airbrake/rails/backtrace_cleaner.rb
airbrake-13.0.0 lib/airbrake/rails/backtrace_cleaner.rb
airbrake-12.0.0 lib/airbrake/rails/backtrace_cleaner.rb
airbrake-11.0.3 lib/airbrake/rails/backtrace_cleaner.rb
airbrake-11.0.2 lib/airbrake/rails/backtrace_cleaner.rb
airbrake-11.0.1 lib/airbrake/rails/backtrace_cleaner.rb
airbrake-11.0.0 lib/airbrake/rails/backtrace_cleaner.rb