Class: Cure::Strategy::StartWithStrategy
- Inherits:
-
BaseStrategy
- Object
- BaseStrategy
- Cure::Strategy::StartWithStrategy
- Defined in:
- lib/cure/strategy/start_with_strategy.rb
Instance Attribute Summary collapse
-
#params ⇒ StartWithStrategyParams
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) ⇒ StartWithStrategy
constructor
A new instance of StartWithStrategy.
Methods inherited from BaseStrategy
Methods included from History
#history, #reset_history, #retrieve_history, #store_history
Constructor Details
#initialize(options) ⇒ StartWithStrategy
Returns a new instance of StartWithStrategy.
14 15 16 |
# File 'lib/cure/strategy/start_with_strategy.rb', line 14 def initialize() super(StartWithStrategyParams.new()) end |
Instance Attribute Details
#params ⇒ StartWithStrategyParams
Additional details needed to make substitution.
12 13 14 |
# File 'lib/cure/strategy/start_with_strategy.rb', line 12 def params @params end |
Instance Method Details
#_describe ⇒ Object
35 36 37 38 39 |
# File 'lib/cure/strategy/start_with_strategy.rb', line 35 def _describe "Start with replacement will look for '#{@params.match}'. " \ "It will do a #{replace_partial_record ? "partial" : "full"} replacement. " \ "[Note: If the value does not include '#{@params.match}', no substitution is made.]" end |
#_replace_value(source_value, generated_value) ⇒ String
27 28 29 30 31 32 33 |
# File 'lib/cure/strategy/start_with_strategy.rb', line 27 def _replace_value(source_value, generated_value) return unless source_value.start_with? @params.match return generated_value unless replace_partial_record @params.match + generated_value end |
#_retrieve_value(source_value) ⇒ Object
gsub catchment group
20 21 22 |
# File 'lib/cure/strategy/start_with_strategy.rb', line 20 def _retrieve_value(source_value) @params.match || nil if source_value.start_with? @params.match end |