Module: Airbrake::Filters::KeysFilter Private
- Includes:
- Loggable
- Included in:
- KeysAllowlist, KeysBlocklist
- Defined in:
- lib/airbrake-ruby/filters/keys_filter.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This is a filter helper that endows a class ability to filter notices’ payload based on the return value of the should_filter?
method that a class that includes this module must implement.
Constant Summary collapse
- FILTERED =
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.
Returns The label to replace real values of filtered payload.
'[Filtered]'.freeze
- VALID_PATTERN_CLASSES =
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.
Returns the array of classes instances of which can compared with payload keys.
[String, Symbol, Regexp].freeze
- FILTERABLE_KEYS =
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.
Returns parts of a Notice’s payload that can be modified by blocklist/allowlist filters.
%i[environment session params].freeze
- FILTERABLE_CONTEXT_KEYS =
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.
Returns parts of a Notice’s context payload that can be modified by blocklist/allowlist filters.
%i[ user # Provided by Airbrake::Rack::HttpHeadersFilter headers referer httpMethod # Provided by Airbrake::Rack::ContextFilter userAddr userAgent ].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(patterns) ⇒ Object
private
Creates a new KeysBlocklist or KeysAllowlist filter that uses the given
patterns
for filtering a notice’s payload. - #should_filter?(_key) ⇒ Boolean private
Methods included from Loggable
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.
43 44 45 |
# File 'lib/airbrake-ruby/filters/keys_filter.rb', line 43 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.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/airbrake-ruby/filters/keys_filter.rb', line 61 def call(notice) unless @valid_patterns eval_proc_patterns! validate_patterns end FILTERABLE_KEYS.each do |key| notice[key] = filter_hash(notice[key]) end FILTERABLE_CONTEXT_KEYS.each { |key| filter_context_key(notice, key) } return unless notice[:context][:url] filter_url(notice) end |
#initialize(patterns) ⇒ Object
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.
Creates a new KeysBlocklist or KeysAllowlist filter that uses the given patterns
for filtering a notice’s payload.
49 50 51 52 |
# File 'lib/airbrake-ruby/filters/keys_filter.rb', line 49 def initialize(patterns) @patterns = patterns @valid_patterns = false end |
#should_filter?(_key) ⇒ Boolean
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.
79 80 81 |
# File 'lib/airbrake-ruby/filters/keys_filter.rb', line 79 def should_filter?(_key) raise NotImplementedError, 'method must be implemented in the included class' end |