An opinionated implementation of the Command pattern for Ruby applications. Cuprum wraps your business logic in a consistent, object-oriented interface and features status and error management, composability and control flow management.
Module-based implementation of the Operation methods.
Use this to convert an already-defined command into an operation.
class CustomOperation < CustomCommand
include Cuprum::Operation::Mixin
end#result => Cuprum::Result (readonly)
#call(*arguments, **keywords, &block) => Cuprum::Operation
Calls the command implementation and stores the result.
#called? => Boolean
#error => Object
#failure? => Boolean
#reset! => Object
Clears the reference to the most recent call of the operation, if any. This allows the result and any referenced data to be garbage collected. Use this method to clear any instance variables or state internal to the operation (an operation should never have external state apart from the last result).
If the operation cannot be run more than once, this method should raise an error.
#status => Symbol, nil
#success? => Boolean
#to_cuprum_result => Cuprum::Result
#value => Object
Back to Documentation | Reference | Cuprum | Cuprum::Operation