Exception: Eco::API::Common::People::Entries::MultipleSearchResults
- Inherits:
-
StandardError
- Object
- StandardError
- Eco::API::Common::People::Entries::MultipleSearchResults
- Defined in:
- lib/eco/api/common/people/entries.rb
Overview
Note:
its main purpose to prevent the false pairing of duplicates or override information between different people.
Error class that allows to handle cases where multiple entries were found for the same criterion.
Instance Attribute Summary collapse
-
#candidates ⇒ Object
readonly
Returns the value of attribute candidates.
-
#property ⇒ Object
readonly
Returns the value of attribute property.
Instance Method Summary collapse
-
#candidate(index) ⇒ Person
The
candidatein theindexposition. -
#identify_candidates(with_index: false) ⇒ Array<String>
The
candidatesidentified. -
#initialize(msg, candidates: [], property: "email") ⇒ MultipleSearchResults
constructor
A new instance of MultipleSearchResults.
Constructor Details
#initialize(msg, candidates: [], property: "email") ⇒ MultipleSearchResults
Returns a new instance of MultipleSearchResults.
15 16 17 18 19 |
# File 'lib/eco/api/common/people/entries.rb', line 15 def initialize(msg, candidates: [], property: "email") @candidates = candidates @property = property super(msg + " " + candidates_summary) end |
Instance Attribute Details
#candidates ⇒ Object (readonly)
Returns the value of attribute candidates.
11 12 13 |
# File 'lib/eco/api/common/people/entries.rb', line 11 def candidates @candidates end |
#property ⇒ Object (readonly)
Returns the value of attribute property.
11 12 13 |
# File 'lib/eco/api/common/people/entries.rb', line 11 def property @property end |
Instance Method Details
#candidate(index) ⇒ Person
Returns the candidate in the index position.
31 32 33 |
# File 'lib/eco/api/common/people/entries.rb', line 31 def candidate(index) candidates[index] end |
#identify_candidates(with_index: false) ⇒ Array<String>
Returns the candidates identified.
23 24 25 26 27 28 |
# File 'lib/eco/api/common/people/entries.rb', line 23 def identify_candidates(with_index: false) candidates.map.each_with_index do |entry, i| index = with_index ? "#{i}. " : "" "#{index} #{entry.identify}" end end |