Class: AtlasEngine::AddressValidation::Validators::Predicates::Province::ValidForCountry

Inherits:
AtlasEngine::AddressValidation::Validators::Predicates::Predicate show all
Defined in:
app/models/atlas_engine/address_validation/validators/predicates/province/valid_for_country.rb

Instance Attribute Summary

Attributes inherited from AtlasEngine::AddressValidation::Validators::Predicates::Predicate

#address, #cache, #field, #message_format

Instance Method Summary collapse

Methods inherited from AtlasEngine::AddressValidation::Validators::Predicates::Predicate

#initialize

Constructor Details

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

Instance Method Details

#evaluateObject



11
12
13
14
15
16
17
18
19
# File 'app/models/atlas_engine/address_validation/validators/predicates/province/valid_for_country.rb', line 11

def evaluate
  return if address.province_code.blank?
  return if @cache.country.zones.none?(&:province?)
  return if @cache.country.hide_provinces_from_addresses

  unless @cache.province.province?
    build_concern
  end
end