Class: MultiRedis::Executor::OperationExecution
- Inherits:
-
Object
- Object
- MultiRedis::Executor::OperationExecution
- Defined in:
- lib/multi_redis/executor.rb
Instance Attribute Summary collapse
-
#final_results ⇒ Object
readonly
Returns the value of attribute final_results.
Instance Method Summary collapse
- #done? ⇒ Boolean
- #execute_current_step ⇒ Object
-
#initialize(operation, args, shared_context) ⇒ OperationExecution
constructor
A new instance of OperationExecution.
- #next?(type) ⇒ Boolean
- #resolve_futures! ⇒ Object
- #resolve_operation_future! ⇒ Object
Constructor Details
#initialize(operation, args, shared_context) ⇒ OperationExecution
Returns a new instance of OperationExecution.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/multi_redis/executor.rb', line 57 def initialize operation, args, shared_context @operation = operation @args = args @context = Context.new shared_context.redis, shared_context @steps = operation.steps @current_index = 0 end |
Instance Attribute Details
#final_results ⇒ Object (readonly)
Returns the value of attribute final_results.
55 56 57 |
# File 'lib/multi_redis/executor.rb', line 55 def final_results @final_results end |
Instance Method Details
#done? ⇒ Boolean
68 69 70 |
# File 'lib/multi_redis/executor.rb', line 68 def done? !current_step end |
#execute_current_step ⇒ Object
76 77 78 79 80 |
# File 'lib/multi_redis/executor.rb', line 76 def execute_current_step results = @context.execute current_step, *@args @current_index += 1 @final_results = results end |
#next?(type) ⇒ Boolean
72 73 74 |
# File 'lib/multi_redis/executor.rb', line 72 def next? type current_step && current_step.type == type end |
#resolve_futures! ⇒ Object
82 83 84 |
# File 'lib/multi_redis/executor.rb', line 82 def resolve_futures! @context.resolve_futures! end |
#resolve_operation_future! ⇒ Object
86 87 88 |
# File 'lib/multi_redis/executor.rb', line 86 def resolve_operation_future! @operation.future.value = @final_results if @operation.future end |