class Trample::LookupNotFoundError

Attributes

condition[R]
corresponding_lookup[R]
lookup_results[R]

Public Class Methods

new(condition, lookup_results, corresponding_lookup) click to toggle source
Calls superclass method
# 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(message)
end

Public Instance Methods

criteria_keys() click to toggle source
# File lib/trample/lookup_not_found.rb, line 25
def criteria_keys
  @criteria_keys ||= Array(condition.values).map { |l| l[:key] }.sort
end
diff() click to toggle source
# File lib/trample/lookup_not_found.rb, line 33
def diff
  criteria_keys - lookup_keys
end
lookup_keys() click to toggle source
# File lib/trample/lookup_not_found.rb, line 29
def lookup_keys
  @lookup_keys ||= Array(lookup_results).map {|l| l[:key] }.sort
end
message() click to toggle source
# File lib/trample/lookup_not_found.rb, line 13
    def message
      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