class SpookAndPay::MissingValueError

A simple error class used to capture situations where the user is attampting to access a value, but it is not available. This is unfortunately necessary due to the way some providers do or do not return certain fields. Rather than allow comparison with nil values we throw this error.

Public Class Methods

new(field, record) click to toggle source

When instancing this error, it needs to have enough information to point the user to the source.

@param [String, Symbol] field @param Class record

# File lib/spook_and_pay/missing_value_error.rb, line 13
def initialize(field, record)
  @field = field
  @record = record
end

Public Instance Methods

to_s() click to toggle source

Human readable error message.

@return String

# File lib/spook_and_pay/missing_value_error.rb, line 21
def to_s
  "The field #{@field} is missing for #{@record.class}"
end