Exception: TypedCache::TypeError
- Defined in:
- lib/typed_cache/errors.rb
Overview
Type safety violations
Instance Attribute Summary collapse
-
#actual_type ⇒ Object
readonly
Returns the value of attribute actual_type.
-
#expected_type ⇒ Object
readonly
Returns the value of attribute expected_type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(expected_type, actual_type, value, message) ⇒ TypeError
constructor
A new instance of TypeError.
- #type_mismatch_message ⇒ Object
Constructor Details
#initialize(expected_type, actual_type, value, message) ⇒ TypeError
Returns a new instance of TypeError.
44 45 46 47 48 49 |
# File 'lib/typed_cache/errors.rb', line 44 def initialize(expected_type, actual_type, value, ) super() @expected_type = expected_type @actual_type = actual_type @value = value end |
Instance Attribute Details
#actual_type ⇒ Object (readonly)
Returns the value of attribute actual_type.
41 42 43 |
# File 'lib/typed_cache/errors.rb', line 41 def actual_type @actual_type end |
#expected_type ⇒ Object (readonly)
Returns the value of attribute expected_type.
41 42 43 |
# File 'lib/typed_cache/errors.rb', line 41 def expected_type @expected_type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
41 42 43 |
# File 'lib/typed_cache/errors.rb', line 41 def value @value end |
Instance Method Details
#type_mismatch_message ⇒ Object
52 53 54 |
# File 'lib/typed_cache/errors.rb', line 52 def "Expected #{expected_type}, got #{actual_type}" end |