Class: Airbrake::Filters::GemRootFilter Private
- Inherits:
-
Object
- Object
- Airbrake::Filters::GemRootFilter
- Defined in:
- lib/airbrake-ruby/filters/gem_root_filter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Replaces paths to gems with a placeholder.
Constant Summary collapse
- GEM_ROOT_LABEL =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'/GEM_ROOT'.freeze
Instance Attribute Summary collapse
- #weight ⇒ Integer readonly private
Instance Method Summary collapse
-
#call(notice) ⇒ void
private
This is a mandatory method required by any filter integrated with FilterChain.
-
#initialize ⇒ GemRootFilter
constructor
private
A new instance of GemRootFilter.
Constructor Details
#initialize ⇒ GemRootFilter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of GemRootFilter.
12 13 14 |
# File 'lib/airbrake-ruby/filters/gem_root_filter.rb', line 12 def initialize @weight = 120 end |
Instance Attribute Details
#weight ⇒ Integer (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/airbrake-ruby/filters/gem_root_filter.rb', line 10 def weight @weight end |
Instance Method Details
#call(notice) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
This is a mandatory method required by any filter integrated with FilterChain.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/airbrake-ruby/filters/gem_root_filter.rb', line 17 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 |