Class: Console::Output::Sensitive::Filter
- Inherits:
-
Object
- Object
- Console::Output::Sensitive::Filter
- Defined in:
- lib/console/output/sensitive.rb
Instance Method Summary collapse
- #call(text) ⇒ Object
-
#initialize(substitutions) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(substitutions) ⇒ Filter
Returns a new instance of Filter.
79 80 81 82 |
# File 'lib/console/output/sensitive.rb', line 79 def initialize(substitutions) @substitutions = substitutions @pattern = Regexp.union(substitutions.keys) end |
Instance Method Details
#call(text) ⇒ Object
84 85 86 |
# File 'lib/console/output/sensitive.rb', line 84 def call(text) text.gsub(@pattern, @substitutions) end |