class TeeLogger::Filter::Assignment

The Assignment filter takes strings of the form <prefix><word>=<value> and obfuscates the value.

Constants

FILTER_TYPES
WINDOW_SIZE

Public Class Methods

new(*args) click to toggle source
Calls superclass method TeeLogger::Filter::FilterBase::new
# 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

Public Instance Methods

process(*args) click to toggle source
# 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