Class: Cure::Strategy::EndWithStrategy
- Inherits:
-
BaseStrategy
- Object
- BaseStrategy
- Cure::Strategy::EndWithStrategy
- Defined in:
- lib/cure/strategy/end_with_strategy.rb
Instance Attribute Summary collapse
-
#params ⇒ EndWithStrategyParams
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) ⇒ EndWithStrategy
constructor
A new instance of EndWithStrategy.
Methods inherited from BaseStrategy
Methods included from History
#history, #reset_history, #retrieve_history, #store_history
Constructor Details
#initialize(options) ⇒ EndWithStrategy
Returns a new instance of EndWithStrategy.
12 13 14 |
# File 'lib/cure/strategy/end_with_strategy.rb', line 12 def initialize() super(EndWithStrategyParams.new()) end |
Instance Attribute Details
#params ⇒ EndWithStrategyParams
Additional details needed to make substitution.
10 11 12 |
# File 'lib/cure/strategy/end_with_strategy.rb', line 10 def params @params end |
Instance Method Details
#_describe ⇒ Object
34 35 36 37 38 |
# File 'lib/cure/strategy/end_with_strategy.rb', line 34 def _describe "End 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
25 26 27 28 29 30 31 32 |
# File 'lib/cure/strategy/end_with_strategy.rb', line 25 def _replace_value(source_value, generated_value) return unless source_value.end_with? @params.match return generated_value unless replace_partial_record generated_value + @params.match # generated_value + source_value.reverse.chomp(@options["match"].reverse).reverse end |
#_retrieve_value(source_value) ⇒ Object
gsub catchment group
18 19 20 |
# File 'lib/cure/strategy/end_with_strategy.rb', line 18 def _retrieve_value(source_value) @params.match || nil if source_value.end_with? @params.match end |