Class: AtlasEngine::Pt::AddressValidation::Validators::FullAddress::Exclusions::Zip

Inherits:
AddressValidation::Validators::FullAddress::Exclusions::ExclusionBase show all
Defined in:
app/countries/atlas_engine/pt/address_validation/validators/full_address/exclusions/zip.rb

Class Method Summary collapse

Class Method Details

.apply?(candidate, address_comparison) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
27
28
29
# File 'app/countries/atlas_engine/pt/address_validation/validators/full_address/exclusions/zip.rb', line 19

def apply?(candidate, address_comparison)
  street_comparison_result = address_comparison.street_comparison.sequence_comparison
  building_comparison_result = address_comparison.building_comparison.sequence_comparison

  return true if street_comparison_result.nil? ||
    building_comparison_result.nil? ||
    T.must(building_comparison_result).candidate_ranges.empty?

  !T.must(street_comparison_result).match? ||
    !T.must(building_comparison_result).match?
end