Exception: Optionoids::Errors::UnexpectedValueVariant

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

Overview

Custom error class to indicate that a values in the current option Hash are not of the expected variants

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, keys: [], variants: []) ⇒ UnexpectedValueVariant

Returns a new instance of UnexpectedValueVariant.



115
116
117
118
119
120
121
# File 'lib/optionoids/errors.rb', line 115

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

Instance Attribute Details

#keysObject (readonly)

Returns the value of attribute keys.



113
114
115
# File 'lib/optionoids/errors.rb', line 113

def keys
  @keys
end

#variantsObject (readonly)

Returns the value of attribute variants.



113
114
115
# File 'lib/optionoids/errors.rb', line 113

def variants
  @variants
end