Cuprum

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: Cuprum::Operation::Mixin

Parent Namespace
Cuprum::Operation
Defined In
lib/cuprum/operation.rb

Table Of Contents

Overview

Module-based implementation of the Operation methods.

Use this to convert an already-defined command into an operation.

Examples

class CustomOperation < CustomCommand
  include Cuprum::Operation::Mixin
end

Back To Top

Instance Attributes

#result => Cuprum::Result (readonly)

Returns

Back To Top

Instance Methods

#call(*arguments, **keywords, &block) => Cuprum::Operation

Calls the command implementation and stores the result.

Parameters

Yields

Returns

See Also

#called? => Boolean

Returns

#error => Object

Returns

#failure? => Boolean

Returns

#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

Returns

#success? => Boolean

Returns

#to_cuprum_result => Cuprum::Result

Returns

#value => Object

Returns

Back To Top


Back to Documentation | Reference | Cuprum | Cuprum::Operation