Exception: Trample::LookupNotFoundError
- Inherits:
-
StandardError
- Object
- StandardError
- Trample::LookupNotFoundError
- Defined in:
- lib/trample/lookup_not_found.rb
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#corresponding_lookup ⇒ Object
readonly
Returns the value of attribute corresponding_lookup.
-
#lookup_results ⇒ Object
readonly
Returns the value of attribute lookup_results.
Instance Method Summary collapse
- #criteria_keys ⇒ Object
- #diff ⇒ Object
-
#initialize(condition, lookup_results, corresponding_lookup) ⇒ LookupNotFoundError
constructor
A new instance of LookupNotFoundError.
- #lookup_keys ⇒ Object
- #message ⇒ Object
Constructor Details
#initialize(condition, lookup_results, corresponding_lookup) ⇒ LookupNotFoundError
Returns a new instance of LookupNotFoundError.
6 7 8 9 10 11 |
# File 'lib/trample/lookup_not_found.rb', line 6 def initialize(condition, lookup_results, corresponding_lookup) @condition = condition @lookup_results = lookup_results @corresponding_lookup = corresponding_lookup super() end |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
4 5 6 |
# File 'lib/trample/lookup_not_found.rb', line 4 def condition @condition end |
#corresponding_lookup ⇒ Object (readonly)
Returns the value of attribute corresponding_lookup.
4 5 6 |
# File 'lib/trample/lookup_not_found.rb', line 4 def corresponding_lookup @corresponding_lookup end |
#lookup_results ⇒ Object (readonly)
Returns the value of attribute lookup_results.
4 5 6 |
# File 'lib/trample/lookup_not_found.rb', line 4 def lookup_results @lookup_results end |
Instance Method Details
#criteria_keys ⇒ Object
25 26 27 |
# File 'lib/trample/lookup_not_found.rb', line 25 def criteria_keys @criteria_keys ||= Array(condition.values).map { |l| l[:key] }.sort end |
#diff ⇒ Object
33 34 35 |
# File 'lib/trample/lookup_not_found.rb', line 33 def diff criteria_keys - lookup_keys end |
#lookup_keys ⇒ Object
29 30 31 |
# File 'lib/trample/lookup_not_found.rb', line 29 def lookup_keys @lookup_keys ||= Array(lookup_results).map {|l| l[:key] }.sort end |
#message ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/trample/lookup_not_found.rb', line 13 def msg = <<-MSG.strip_heredoc No corresponding lookup found for condition #{condition.name} Corresponding Lookup Result: #{ corresponding_lookup } Criteria Keys: #{ criteria_keys.join(", ") } Lookup Result Keys: #{ lookup_keys.join(", ") } Missing: #{ diff.join(", ") } MSG end |