Class: Cuprum::Command
- Inherits:
-
Object
- Object
- Cuprum::Command
- Includes:
- Chaining, Processing, ResultHelpers
- Defined in:
- lib/cuprum/command.rb
Overview
Functional object that encapsulates a business logic operation with a consistent interface and tracking of result value and status.
A Command can be defined either by passing a block to the constructor, or by defining a subclass of Command and implementing the #process method.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize {|*arguments, **keywords, &block| ... } ⇒ Command
constructor
Returns a new instance of Cuprum::Command.
Methods included from ResultHelpers
#errors, #failure!, #halt!, #success!
Methods included from Chaining
#chain, #failure, #success, #tap_result, #yield_result
Methods included from Processing
#arity, #build_errors, #call, #process
Constructor Details
#initialize {|*arguments, **keywords, &block| ... } ⇒ Command
Returns a new instance of Cuprum::Command.
127 128 129 |
# File 'lib/cuprum/command.rb', line 127 def initialize &implementation define_singleton_method :process, &implementation if implementation end |