Exception: Optionoids::Errors::UnexpectedValueVariant
- Inherits:
-
StandardError
- Object
- StandardError
- Optionoids::Errors::UnexpectedValueVariant
- 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
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#variants ⇒ Object
readonly
Returns the value of attribute variants.
Instance Method Summary collapse
-
#initialize(message = nil, keys: [], variants: []) ⇒ UnexpectedValueVariant
constructor
A new instance of UnexpectedValueVariant.
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( = nil, keys: [], variants: []) @keys = keys @variants = variants msg = || "Unexpected value variants for keys: #{keys.to_sentence}. " \ "Expected variants: #{variants.to_sentence}" super(msg) end |
Instance Attribute Details
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
113 114 115 |
# File 'lib/optionoids/errors.rb', line 113 def keys @keys end |
#variants ⇒ Object (readonly)
Returns the value of attribute variants.
113 114 115 |
# File 'lib/optionoids/errors.rb', line 113 def variants @variants end |