Class: FluentCommandBuilder::PasswordFormatter
- Inherits:
-
Object
- Object
- FluentCommandBuilder::PasswordFormatter
- Defined in:
- lib/fluent_command_builder/password_formatter.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#replacement ⇒ Object
Returns the value of attribute replacement.
Instance Method Summary collapse
- #format(command, passwords) ⇒ Object
-
#initialize ⇒ PasswordFormatter
constructor
A new instance of PasswordFormatter.
Constructor Details
#initialize ⇒ PasswordFormatter
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
#enabled ⇒ Object
Returns the value of attribute enabled.
4 5 6 |
# File 'lib/fluent_command_builder/password_formatter.rb', line 4 def enabled @enabled end |
#replacement ⇒ Object
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 |