Exception: Type::Error
- Inherits:
-
TypeError
- Object
- TypeError
- Type::Error
- Defined in:
- lib/type/error.rb
Overview
An Error class for exceptions raised while validating or casting
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cause ⇒ Object
readonly
Returns the value of attribute cause.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#type_definition ⇒ Object
readonly
Returns the value of attribute type_definition.
Instance Method Summary collapse
-
#initialize(input, type_definition) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(input, type_definition) ⇒ Error
Returns a new instance of Error.
6 7 8 9 10 |
# File 'lib/type/error.rb', line 6 def initialize(input, type_definition) @input = input @type_definition = type_definition @cause = $! # aka $ERROR_INFO end |
Instance Attribute Details
#cause ⇒ Object (readonly)
Returns the value of attribute cause.
16 17 18 |
# File 'lib/type/error.rb', line 16 def cause @cause end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
16 17 18 |
# File 'lib/type/error.rb', line 16 def input @input end |
#type_definition ⇒ Object (readonly)
Returns the value of attribute type_definition.
16 17 18 |
# File 'lib/type/error.rb', line 16 def type_definition @type_definition end |
Instance Method Details
#to_s ⇒ Object
12 13 14 |
# File 'lib/type/error.rb', line 12 def to_s "<#{self.class.name}: #{}#{caused_by_clause}>" end |