Class: FluentCommandBuilder::PasswordFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent_command_builder/password_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePasswordFormatter

Returns a new instance of PasswordFormatter.



6
7
8
9
# File 'lib/fluent_command_builder/password_formatter.rb', line 6

def initialize
  @enabled = true
  @replacement = '***'
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



4
5
6
# File 'lib/fluent_command_builder/password_formatter.rb', line 4

def enabled
  @enabled
end

#replacementObject

Returns the value of attribute replacement.



4
5
6
# File 'lib/fluent_command_builder/password_formatter.rb', line 4

def replacement
  @replacement
end

Instance Method Details

#format(command, passwords) ⇒ Object



11
12
13
14
15
# File 'lib/fluent_command_builder/password_formatter.rb', line 11

def format(command, passwords)
  return command unless @enabled
  passwords.each { |p| command.gsub! p, @replacement }
  command
end