Class: CC::Service::Invocation::WithReturnValues
- Inherits:
-
Object
- Object
- CC::Service::Invocation::WithReturnValues
- Defined in:
- lib/cc/service/invocation/with_return_values.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(invocation, message = nil) ⇒ WithReturnValues
constructor
A new instance of WithReturnValues.
Constructor Details
#initialize(invocation, message = nil) ⇒ WithReturnValues
Returns a new instance of WithReturnValues.
3 4 5 6 |
# File 'lib/cc/service/invocation/with_return_values.rb', line 3 def initialize(invocation, = nil) @invocation = invocation @message = || "An internal error happened" end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/cc/service/invocation/with_return_values.rb', line 8 def call result = @invocation.call if result.nil? { ok: false, message: @message } else result end end |