Class: AtlasEngine::AddressValidation::Validators::Predicates::Street::BuildingNumberInAddress1OrAddress2

Inherits:
Predicate
  • Object
show all
Defined in:
app/models/atlas_engine/address_validation/validators/predicates/street/building_number_in_address1_or_address2.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

#evaluateObject



11
12
13
14
15
16
17
# File 'app/models/atlas_engine/address_validation/validators/predicates/street/building_number_in_address1_or_address2.rb', line 11

def evaluate
  return unless @cache.country.building_number_required
  return unless @cache.country.building_number_may_be_in_address2
  return if contains_number?(T.must(@address.address1)) || contains_number?(@address.address2)

  build_concern
end