Class: Cure::Strategy::MatchStrategy
- Inherits:
-
BaseStrategy
- Object
- BaseStrategy
- Cure::Strategy::MatchStrategy
- Defined in:
- lib/cure/strategy/match_strategy.rb
Instance Attribute Summary collapse
-
#params ⇒ MatchStrategyParams
Additional details needed to make substitution.
Instance Method Summary collapse
- #_describe ⇒ Object
- #_replace_value(source_value, generated_value) ⇒ String
-
#_retrieve_value(source_value) ⇒ Object
gsub catchment group.
-
#initialize(options) ⇒ MatchStrategy
constructor
A new instance of MatchStrategy.
Methods inherited from BaseStrategy
Methods included from History
#history, #reset_history, #retrieve_history, #store_history
Constructor Details
#initialize(options) ⇒ MatchStrategy
Returns a new instance of MatchStrategy.
12 13 14 |
# File 'lib/cure/strategy/match_strategy.rb', line 12 def initialize() super(MatchStrategyParams.new()) end |
Instance Attribute Details
#params ⇒ MatchStrategyParams
Additional details needed to make substitution.
10 11 12 |
# File 'lib/cure/strategy/match_strategy.rb', line 10 def params @params end |
Instance Method Details
#_describe ⇒ Object
31 32 33 34 |
# File 'lib/cure/strategy/match_strategy.rb', line 31 def _describe "Match replacement will look for the presence of '#{@params.match}', and replace that value. " \ "[Note: If the value does not include '#{@params.match}', no substitution is made.]" end |
#_replace_value(source_value, generated_value) ⇒ String
25 26 27 28 29 |
# File 'lib/cure/strategy/match_strategy.rb', line 25 def _replace_value(source_value, generated_value) return source_value unless source_value.include? @params.match source_value.gsub(@params.match, generated_value) end |
#_retrieve_value(source_value) ⇒ Object
gsub catchment group
18 19 20 |
# File 'lib/cure/strategy/match_strategy.rb', line 18 def _retrieve_value(source_value) @params.match || nil if source_value.include? @params.match end |