Class: AtlasEngine::AddressValidation::Validators::FullAddress::ProvinceCodeComparison
- Inherits:
-
FieldComparisonBase
- Object
- FieldComparisonBase
- AtlasEngine::AddressValidation::Validators::FullAddress::ProvinceCodeComparison
show all
- Extended by:
- T::Sig
- Defined in:
- app/models/atlas_engine/address_validation/validators/full_address/province_code_comparison.rb
Instance Attribute Summary
#component
Instance Method Summary
collapse
#initialize, #match?
Instance Method Details
#relevant? ⇒ Boolean
12
13
14
|
# File 'app/models/atlas_engine/address_validation/validators/full_address/province_code_comparison.rb', line 12
def relevant?
true
end
|
#sequence_comparison ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/models/atlas_engine/address_validation/validators/full_address/province_code_comparison.rb', line 17
def sequence_comparison
return @province_code_comparison if defined?(@province_code_comparison)
normalized_session_province_code = ValidationTranscriber::ProvinceCodeNormalizer.normalize(
country_code: address.country_code,
province_code: address.province_code,
)
normalized_candidate_province_code = ValidationTranscriber::ProvinceCodeNormalizer.normalize(
country_code: T.must(candidate.component(:country_code)).value,
province_code: T.must(candidate.component(:province_code)).value,
)
@province_code_comparison = best_comparison(
Token::Sequence.from_string(normalized_session_province_code),
[Token::Sequence.from_string(normalized_candidate_province_code)],
field_policy(:province_code),
)
end
|