Class: AtlasEngine::AddressValidation::Validators::FullAddress::RelevantComponents

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
app/models/atlas_engine/address_validation/validators/full_address/relevant_components.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address_comparison, matching_strategy) ⇒ RelevantComponents

Returns a new instance of RelevantComponents.



23
24
25
26
27
28
29
# File 'app/models/atlas_engine/address_validation/validators/full_address/relevant_components.rb', line 23

def initialize(address_comparison, matching_strategy)
  @address_comparison = address_comparison
  @matching_strategy = matching_strategy
  @address = address_comparison.address
  @candidate = address_comparison.candidate
  @all_supported_components = address_comparison.relevant_components.dup
end

Instance Attribute Details

#address_comparisonObject (readonly)

Returns the value of attribute address_comparison.



15
16
17
# File 'app/models/atlas_engine/address_validation/validators/full_address/relevant_components.rb', line 15

def address_comparison
  @address_comparison
end

#candidateObject (readonly)

Returns the value of attribute candidate.



12
13
14
# File 'app/models/atlas_engine/address_validation/validators/full_address/relevant_components.rb', line 12

def candidate
  @candidate
end

Instance Method Details

#components_to_compareObject



40
41
42
# File 'app/models/atlas_engine/address_validation/validators/full_address/relevant_components.rb', line 40

def components_to_compare
  @all_supported_components.dup - unsupported_components_for_country
end

#components_to_validateObject



32
33
34
35
36
37
# File 'app/models/atlas_engine/address_validation/validators/full_address/relevant_components.rb', line 32

def components_to_validate
  supported_components = @all_supported_components.dup - unsupported_components_for_country
  apply_exclusions(supported_components)
  supported_components.delete(:street) if exclude_street_validation?
  supported_components
end