Class: HTTPigeon::LogRedactor
- Inherits:
-
Object
- Object
- HTTPigeon::LogRedactor
- Defined in:
- lib/httpigeon/log_redactor.rb
Defined Under Namespace
Classes: UnsupportedRegexpError
Instance Attribute Summary collapse
-
#log_filters ⇒ Object
readonly
Returns the value of attribute log_filters.
Instance Method Summary collapse
-
#initialize(log_filters: nil) ⇒ LogRedactor
constructor
A new instance of LogRedactor.
- #redact(data) ⇒ Object
Constructor Details
#initialize(log_filters: nil) ⇒ LogRedactor
Returns a new instance of LogRedactor.
9 10 11 |
# File 'lib/httpigeon/log_redactor.rb', line 9 def initialize(log_filters: nil) @log_filters = log_filters.to_a.map(&:to_s) end |
Instance Attribute Details
#log_filters ⇒ Object (readonly)
Returns the value of attribute log_filters.
7 8 9 |
# File 'lib/httpigeon/log_redactor.rb', line 7 def log_filters @log_filters end |
Instance Method Details
#redact(data) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/httpigeon/log_redactor.rb', line 13 def redact(data) case data when Array data.map { |datum| redact(datum) } when String redact_string(data) when Hash redact_hash(data) else data end end |