Class: CallbackSequencer
- Inherits:
-
Object
- Object
- CallbackSequencer
- Defined in:
- lib/callback-batch.rb
Overview
Sequencer for running batches upon single object.
Instance Attribute Summary collapse
-
#batch ⇒ EM::Batch
Holds the batch object.
-
#target ⇒ Object
Holds the target object.
Instance Method Summary collapse
-
#execute(&callback) ⇒ Object
(also: #execute!)
Executes the batch.
-
#initialize(target) ⇒ CallbackSequencer
constructor
Constructor.
-
#method_missing(name, *args) ⇒ Object
Handles missing method calls.
-
#results ⇒ Array
Returns all calls results.
Constructor Details
#initialize(target) ⇒ CallbackSequencer
Constructor.
31 32 33 34 |
# File 'lib/callback-batch.rb', line 31 def initialize(target) @batch = CallbackBatch::new @target = target end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
Handles missing method calls. Puts them to the processing batch.
44 45 46 |
# File 'lib/callback-batch.rb', line 44 def method_missing(name, *args) @batch.put(@target, name, args) end |
Instance Attribute Details
#batch ⇒ EM::Batch
Holds the batch object.
15 16 17 |
# File 'lib/callback-batch.rb', line 15 def batch @batch end |
#target ⇒ Object
Holds the target object.
23 24 25 |
# File 'lib/callback-batch.rb', line 23 def target @target end |
Instance Method Details
#execute(&callback) ⇒ Object Also known as: execute!
Executes the batch.
53 54 55 |
# File 'lib/callback-batch.rb', line 53 def execute(&callback) @batch.execute(&callback) end |
#results ⇒ Array
Returns all calls results.
64 65 66 |
# File 'lib/callback-batch.rb', line 64 def results @batch.results end |