Class: StringMasker
- Inherits:
-
Object
- Object
- StringMasker
- Defined in:
- lib/string_masker.rb
Instance Attribute Summary collapse
-
#output_string ⇒ Object
Returns the value of attribute output_string.
-
#params ⇒ Object
Returns the value of attribute params.
-
#string ⇒ Object
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(string, params) ⇒ StringMasker
constructor
A new instance of StringMasker.
- #to_s ⇒ Object
Constructor Details
#initialize(string, params) ⇒ StringMasker
Returns a new instance of StringMasker.
4 5 6 7 8 9 10 11 12 |
# File 'lib/string_masker.rb', line 4 def initialize(string, params) output_string = string.dup params.each do |key, value| output_string.gsub!(value, "[#{key}]") end @output_string = output_string end |
Instance Attribute Details
#output_string ⇒ Object
Returns the value of attribute output_string.
2 3 4 |
# File 'lib/string_masker.rb', line 2 def output_string @output_string end |
#params ⇒ Object
Returns the value of attribute params.
2 3 4 |
# File 'lib/string_masker.rb', line 2 def params @params end |
#string ⇒ Object
Returns the value of attribute string.
2 3 4 |
# File 'lib/string_masker.rb', line 2 def string @string end |
Instance Method Details
#to_s ⇒ Object
14 15 16 |
# File 'lib/string_masker.rb', line 14 def to_s output_string end |