Class: TaskArgumentFilterer

Inherits:
Object show all
Defined in:
lib/volt/utils/logging/task_argument_filterer.rb

Overview

TaskArgumentFilterer will recursively walk any arguemnts to a task and filter any hashes with a filtered key. By default only :password is filtered, but you can add more with Volt.config.filter_keys

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ TaskArgumentFilterer

Returns a new instance of TaskArgumentFilterer.



9
10
11
12
13
14
15
16
17
# File 'lib/volt/utils/logging/task_argument_filterer.rb', line 9

def initialize(args)
  # # Cache the filter args
  @@filter_args ||= begin
    # Load, with default, convert to symbols
    arg_names = (Volt.config.filter_keys || [:password]).map(&:to_sym)
  end

  @args = args
end

Class Method Details

.filter(args) ⇒ Object



5
6
7
# File 'lib/volt/utils/logging/task_argument_filterer.rb', line 5

def self.filter(args)
  self.new(args).run
end

Instance Method Details

#runObject



19
20
21
# File 'lib/volt/utils/logging/task_argument_filterer.rb', line 19

def run
  filter_args(@args)
end