Class: AtlasEngine::AddressValidation::Validators::Predicates::Zip::ValidForCountry

Inherits:
ZipBase
  • Object
show all
Defined in:
app/models/atlas_engine/address_validation/validators/predicates/zip/valid_for_country.rb

Instance Attribute Summary

Attributes inherited from Predicate

#address, #cache, #field, #message_format

Instance Method Summary collapse

Methods inherited from Predicate

#initialize

Constructor Details

This class inherits a constructor from AtlasEngine::AddressValidation::Validators::Predicates::Predicate

Instance Method Details

#concerning?Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
# File 'app/models/atlas_engine/address_validation/validators/predicates/zip/valid_for_country.rb', line 16

def concerning?
  return false unless super
  return false if @address.zip.blank?
  return false if @cache.country.valid_zip?(@address.zip)

  true
end

#evaluateObject



11
12
13
# File 'app/models/atlas_engine/address_validation/validators/predicates/zip/valid_for_country.rb', line 11

def evaluate
  build_concern if concerning?
end