Exception: Optionoids::Errors::UnexpectedValueType

Inherits:
StandardError
  • Object
show all
Defined in:
lib/optionoids/errors.rb

Overview

Custom error class to indicate that the values for the keys are not of the expected types

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, keys: [], types: []) ⇒ UnexpectedValueType

Returns a new instance of UnexpectedValueType.



101
102
103
104
105
106
107
# File 'lib/optionoids/errors.rb', line 101

def initialize(message = nil, keys: [], types: [])
  @keys = keys
  @types = types
  msg = message || "Unexpected value types for keys: #{keys.to_sentence}. " \
                   "Expected types: #{types.to_sentence}"
  super(msg)
end

Instance Attribute Details

#keysObject (readonly)

Returns the value of attribute keys.



99
100
101
# File 'lib/optionoids/errors.rb', line 99

def keys
  @keys
end

#typesObject (readonly)

Returns the value of attribute types.



99
100
101
# File 'lib/optionoids/errors.rb', line 99

def types
  @types
end