Exception: Seatbelt::Errors::TypeMissmatchError
- Inherits:
-
StandardError
- Object
- StandardError
- Seatbelt::Errors::TypeMissmatchError
- Defined in:
- lib/seatbelt/errors/errors.rb
Overview
Public: Will be raised if a model is assigned to a ‘has_many’ association and the models class isn’t of required type.
Instance Attribute Summary collapse
-
#awaited ⇒ Object
Returns the value of attribute awaited.
-
#got ⇒ Object
Returns the value of attribute got.
Instance Method Summary collapse
-
#initialize(awaited, got) ⇒ TypeMissmatchError
constructor
Public: Initialize a TypeMissmatchError.
-
#to_s ⇒ Object
The exception message in an understandable form.
Constructor Details
#initialize(awaited, got) ⇒ TypeMissmatchError
Public: Initialize a TypeMissmatchError.
awaited - The awaited objects class name got - The actual assigned objects class name.
74 75 76 77 |
# File 'lib/seatbelt/errors/errors.rb', line 74 def initialize(awaited, got) @awaited = awaited @got = got end |
Instance Attribute Details
#awaited ⇒ Object
Returns the value of attribute awaited.
68 69 70 |
# File 'lib/seatbelt/errors/errors.rb', line 68 def awaited @awaited end |
#got ⇒ Object
Returns the value of attribute got.
68 69 70 |
# File 'lib/seatbelt/errors/errors.rb', line 68 def got @got end |
Instance Method Details
#to_s ⇒ Object
The exception message in an understandable form.
Returns the error message.
82 83 84 85 86 |
# File 'lib/seatbelt/errors/errors.rb', line 82 def to_s msg = "An instance of #{awaited} awaited but " msg += "get an instance of #{got}." return msg end |