Exception: SafeType::EmptyValueError
- Inherits:
-
StandardError
- Object
- StandardError
- SafeType::EmptyValueError
- Defined in:
- lib/safe_type/errors.rb
Instance Attribute Summary collapse
-
#desired_type ⇒ Object
readonly
Returns the value of attribute desired_type.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(desired_type, key = nil) ⇒ EmptyValueError
constructor
A new instance of EmptyValueError.
Constructor Details
#initialize(desired_type, key = nil) ⇒ EmptyValueError
Returns a new instance of EmptyValueError.
38 39 40 41 42 43 44 |
# File 'lib/safe_type/errors.rb', line 38 def initialize(desired_type, key=nil) super("Expected a " + (key.nil? ? '' : "key (#{key}) with ") + "value of desired type (#{desired_type}), but received a nil value") @key = key @desired_type = desired_type end |
Instance Attribute Details
#desired_type ⇒ Object (readonly)
Returns the value of attribute desired_type.
36 37 38 |
# File 'lib/safe_type/errors.rb', line 36 def desired_type @desired_type end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
35 36 37 |
# File 'lib/safe_type/errors.rb', line 35 def key @key end |