class Airbrake::Filters::GemRootFilter
Replaces paths to gems with a placeholder.
Constants
- GEM_ROOT_LABEL
@return [String]
Attributes
weight[R]
@return [Integer]
Public Class Methods
new()
click to toggle source
# File lib/airbrake-ruby/filters/gem_root_filter.rb, line 14 def initialize @weight = 120 end
Public Instance Methods
call(notice)
click to toggle source
# File lib/airbrake-ruby/filters/gem_root_filter.rb, line 18 def call(notice) return unless defined?(Gem) notice[:errors].each do |error| Gem.path.each do |gem_path| error[:backtrace].each do |frame| # If the frame is unparseable, then 'file' is nil, thus nothing to # filter (all frame's data is in 'function' instead). next unless (file = frame[:file]) frame[:file] = file.sub(/\A#{gem_path}/, GEM_ROOT_LABEL) end end end end