Class: Hermes::Logger::ParamsFilter
- Inherits:
-
Object
- Object
- Hermes::Logger::ParamsFilter
- Defined in:
- lib/hermes/logger/params_filter.rb
Instance Method Summary collapse
- #call(attribute, value) ⇒ Object
-
#initialize(sensitive_keywords: SENSITIVE_ATTRIBUTES_KEYWORDS, stripped_value: STRIPPED_VALUE) ⇒ ParamsFilter
constructor
A new instance of ParamsFilter.
Constructor Details
#initialize(sensitive_keywords: SENSITIVE_ATTRIBUTES_KEYWORDS, stripped_value: STRIPPED_VALUE) ⇒ ParamsFilter
Returns a new instance of ParamsFilter.
13 14 15 16 |
# File 'lib/hermes/logger/params_filter.rb', line 13 def initialize(sensitive_keywords: SENSITIVE_ATTRIBUTES_KEYWORDS, stripped_value: STRIPPED_VALUE) @sensitive_keywords = sensitive_keywords @stripped_value = stripped_value end |
Instance Method Details
#call(attribute, value) ⇒ Object
18 19 20 21 22 |
# File 'lib/hermes/logger/params_filter.rb', line 18 def call(attribute, value) if sensitive_keywords.any? { |sensitive_attribute| match?(sensitive_attribute, attribute) } && value.respond_to?(:to_str) value.gsub!(value, stripped_value) end end |