Class: Cuprum::Command
- Inherits:
-
Object
- Object
- Cuprum::Command
- Includes:
- Chaining, Processing
- 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 Chaining
#call, #chain, #chain!, #tap_result, #tap_result!, #yield_result, #yield_result!
Methods included from Processing
Constructor Details
#initialize {|*arguments, **keywords, &block| ... } ⇒ Command
Returns a new instance of Cuprum::Command.
122 123 124 125 126 127 128 |
# File 'lib/cuprum/command.rb', line 122 def initialize &implementation return unless implementation define_singleton_method :process, &implementation singleton_class.send(:private, :process) end |