Class: Cuprum::Errors::OperationNotCalled
- Inherits:
-
Cuprum::Error
- Object
- Cuprum::Error
- Cuprum::Errors::OperationNotCalled
- Defined in:
- lib/cuprum/errors/operation_not_called.rb
Overview
Error class to be used when trying to access the result of an uncalled Operation.
Constant Summary collapse
- MESSAGE_FORMAT =
Format for generating error message.
'%s was not called and does not have a result'
Instance Attribute Summary collapse
-
#operation ⇒ Cuprum::Operation
readonly
The uncalled operation.
Attributes inherited from Cuprum::Error
Instance Method Summary collapse
-
#initialize(operation:) ⇒ OperationNotCalled
constructor
A new instance of OperationNotCalled.
Methods inherited from Cuprum::Error
Constructor Details
#initialize(operation:) ⇒ OperationNotCalled
Returns a new instance of OperationNotCalled.
17 18 19 20 21 22 23 24 |
# File 'lib/cuprum/errors/operation_not_called.rb', line 17 def initialize(operation:) @operation = operation class_name = operation&.class&.name || 'operation' = MESSAGE_FORMAT % class_name super(message: ) end |
Instance Attribute Details
#operation ⇒ Cuprum::Operation (readonly)
Returns The uncalled operation.
27 28 29 |
# File 'lib/cuprum/errors/operation_not_called.rb', line 27 def operation @operation end |