Class: AtlasEngine::AddressValidation::Validators::FullAddress::CandidateResult

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

Instance Method Summary collapse

Methods included from LogHelper

#log_error, #log_info, #log_warn

Constructor Details

#initialize(address_comparison:, matching_strategy:, result:, message_format:) ⇒ CandidateResult

Returns a new instance of CandidateResult.



20
21
22
23
24
25
# File 'app/models/atlas_engine/address_validation/validators/full_address/candidate_result.rb', line 20

def initialize(address_comparison:, matching_strategy:, result:, message_format:)
  super(address: address_comparison.address, result: result, message_format: message_format)
  @address_comparison = address_comparison
  @candidate = address_comparison.candidate
  @matching_strategy = matching_strategy
end

Instance Method Details

#suggestable?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/models/atlas_engine/address_validation/validators/full_address/candidate_result.rb', line 37

def suggestable?
  ConcernBuilder.should_suggest?(address, unmatched_components.keys)
end

#update_resultObject



28
29
30
31
32
33
34
# File 'app/models/atlas_engine/address_validation/validators/full_address/candidate_result.rb', line 28

def update_result
  result.candidate = candidate.serialize
  return if unmatched_components_to_validate.empty?

  update_concerns_and_suggestions
  update_result_scope
end