Class: TeeLogger::Filter::Assignment
- Inherits:
-
FilterBase
- Object
- FilterBase
- TeeLogger::Filter::Assignment
- Defined in:
- lib/teelogger/filters/assignment.rb
Overview
The Assignment filter takes strings of the form <prefix><word>=<value> and obfuscates the value.
Constant Summary collapse
- FILTER_TYPES =
[String]
- WINDOW_SIZE =
1
Instance Attribute Summary
Attributes inherited from FilterBase
Instance Method Summary collapse
-
#initialize(*args) ⇒ Assignment
constructor
A new instance of Assignment.
- #process(*args) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Assignment
Returns a new instance of Assignment.
19 20 21 22 23 24 25 26 27 |
# File 'lib/teelogger/filters/assignment.rb', line 19 def initialize(*args) super(*args) # We create more complex matches out of the filter words passed. @matches = [] run_data[:words].each do |word| @matches << /(-{0,2}#{word} *[=:] *)(.*)/i end end |
Instance Method Details
#process(*args) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/teelogger/filters/assignment.rb', line 29 def process(*args) # Note that due to the window size of one, args is only an element long. args.each do |arg| @matches.each do |match| # Modify the matching arguments in place arg.gsub!(match, "\1#{::TeeLogger::Filter::REDACTED_WORD}") end end return args end |