Module: Cuprum::Processing
- Included in:
- Command
- Defined in:
- lib/cuprum/processing.rb
Overview
Functional implementation for creating a command object. Cuprum::Processing defines a #call method, which performs the implementation defined by #process and returns an instance of Cuprum::Result.
Instance Method Summary collapse
-
#arity ⇒ Integer
Returns a nonnegative integer for commands that take a fixed number of arguments.
-
#call(*arguments, **keywords) { ... } ⇒ Cuprum::Result
Executes the command implementation and returns a Cuprum::Result or compatible object.
-
#process(*arguments, **keywords) { ... } ⇒ Object
The implementation of the command, to be executed when the #call method is called.
Instance Method Details
#arity ⇒ Integer
Returns a nonnegative integer for commands that take a fixed number of arguments. For commands that take a variable number of arguments, returns -n-1, where n is the number of required arguments.
69 70 71 |
# File 'lib/cuprum/processing.rb', line 69 def arity method(:process).arity end |
#call(*arguments, **keywords) { ... } ⇒ Cuprum::Result
99 100 101 |
# File 'lib/cuprum/processing.rb', line 99 def call *args, &block process_with_result(build_result, *args, &block) end |
#process(*arguments, **keywords) { ... } ⇒ Object
Note:
This is a private method.
147 148 149 |
# File 'lib/cuprum/processing.rb', line 147 def process *_args raise Cuprum::Errors::ProcessNotImplementedError, nil, caller(1..-1) end |