Class: Intercept::Strategy::Replace
- Inherits:
-
Object
- Object
- Intercept::Strategy::Replace
- Defined in:
- lib/intercept/strategy/replace.rb
Instance Attribute Summary collapse
-
#replace_value ⇒ Object
readonly
Returns the value of attribute replace_value.
Instance Method Summary collapse
-
#initialize(replace_value) ⇒ Replace
constructor
A new instance of Replace.
- #process(value) ⇒ Object
Constructor Details
#initialize(replace_value) ⇒ Replace
8 9 10 |
# File 'lib/intercept/strategy/replace.rb', line 8 def initialize(replace_value) @replace_value = parse_replace_value replace_value end |
Instance Attribute Details
#replace_value ⇒ Object (readonly)
Returns the value of attribute replace_value.
6 7 8 |
# File 'lib/intercept/strategy/replace.rb', line 6 def replace_value @replace_value end |
Instance Method Details
#process(value) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/intercept/strategy/replace.rb', line 12 def process(value) if value.nil? || value.empty? value else replace_value.call end end |