Class: AtlasEngine::AddressValidation::Token::Sequence::ComparisonPolicy
- Inherits:
-
Object
- Object
- AtlasEngine::AddressValidation::Token::Sequence::ComparisonPolicy
- Extended by:
- T::Sig
- Defined in:
- app/models/atlas_engine/address_validation/token/sequence/comparison_policy.rb
Constant Summary collapse
- UNMATCHED_POLICIES =
[ :retain, # keep all unmatched tokens in comparison :ignore_left_unmatched, # omit unmatched tokens from left sequence in comparison :ignore_right_unmatched, # omit unmatched tokens from right sequence in comparison :ignore_largest_unmatched_side, # omit unmatched tokens from the side with the most unmatched tokens, # omit from left in case of a tie ].freeze
- DEFAULT_POLICY =
ComparisonPolicy.new(unmatched: :retain).freeze
Instance Attribute Summary collapse
-
#unmatched ⇒ Object
readonly
Returns the value of attribute unmatched.
Instance Method Summary collapse
-
#initialize(unmatched:) ⇒ ComparisonPolicy
constructor
A new instance of ComparisonPolicy.
Constructor Details
#initialize(unmatched:) ⇒ ComparisonPolicy
Returns a new instance of ComparisonPolicy.
22 23 24 25 26 |
# File 'app/models/atlas_engine/address_validation/token/sequence/comparison_policy.rb', line 22 def initialize(unmatched:) raise "Unknown unmatched policy: #{unmatched}" if UNMATCHED_POLICIES.exclude?(unmatched) @unmatched = unmatched end |
Instance Attribute Details
#unmatched ⇒ Object (readonly)
Returns the value of attribute unmatched.
19 20 21 |
# File 'app/models/atlas_engine/address_validation/token/sequence/comparison_policy.rb', line 19 def unmatched @unmatched end |