Class: Choria::Orchestrator::Task::ResultSet
- Inherits:
-
Object
- Object
- Choria::Orchestrator::Task::ResultSet
- Defined in:
- lib/choria/orchestrator/task/result_set.rb
Instance Attribute Summary collapse
-
#pending_count ⇒ Object
Returns the value of attribute pending_count.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(on_result:) ⇒ ResultSet
constructor
A new instance of ResultSet.
- #integrate_result(result) ⇒ Object
- #integrate_rpc_error(rpc_error) ⇒ Object
Constructor Details
#initialize(on_result:) ⇒ ResultSet
Returns a new instance of ResultSet.
11 12 13 14 15 |
# File 'lib/choria/orchestrator/task/result_set.rb', line 11 def initialize(on_result:) @results = [] @on_result = on_result @pending_count = 0 end |
Instance Attribute Details
#pending_count ⇒ Object
Returns the value of attribute pending_count.
9 10 11 |
# File 'lib/choria/orchestrator/task/result_set.rb', line 9 def pending_count @pending_count end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
7 8 9 |
# File 'lib/choria/orchestrator/task/result_set.rb', line 7 def results @results end |
Instance Method Details
#integrate_result(result) ⇒ Object
23 24 25 26 27 |
# File 'lib/choria/orchestrator/task/result_set.rb', line 23 def integrate_result(result) structured_result = Choria::Colt::DataStructurer.structure(result).with_indifferent_access @results << structured_result @on_result&.call(structured_result, @results.count, pending_count + @results.count) end |
#integrate_rpc_error(rpc_error) ⇒ Object
17 18 19 20 21 |
# File 'lib/choria/orchestrator/task/result_set.rb', line 17 def integrate_rpc_error(rpc_error) result = rpc_error[:body] result[:sender] = rpc_error[:senderid] integrate_result(result) end |