Class: Together::Executor
- Inherits:
-
Object
- Object
- Together::Executor
- Includes:
- Mandate
- Defined in:
- lib/together/executor.rb
Instance Attribute Summary collapse
-
#exceptions ⇒ Object
readonly
Returns the value of attribute exceptions.
-
#mandates ⇒ Object
readonly
Returns the value of attribute mandates.
-
#raise_exceptions ⇒ Object
readonly
Returns the value of attribute raise_exceptions.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#threads ⇒ Object
readonly
Returns the value of attribute threads.
-
#timeout_time ⇒ Object
readonly
Returns the value of attribute timeout_time.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(mandates, timeout:, raise_exceptions:) ⇒ Executor
constructor
Timeout is in seconds.
Constructor Details
#initialize(mandates, timeout:, raise_exceptions:) ⇒ Executor
Timeout is in seconds
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/together/executor.rb', line 10 def initialize(mandates, timeout: , raise_exceptions: ) @mandates = mandates @timeout_time = Time.now.to_f + timeout @raise_exceptions = raise_exceptions @results = Results.new(mandates.size) @threads = [] end |
Instance Attribute Details
#exceptions ⇒ Object (readonly)
Returns the value of attribute exceptions.
5 6 7 |
# File 'lib/together/executor.rb', line 5 def exceptions @exceptions end |
#mandates ⇒ Object (readonly)
Returns the value of attribute mandates.
5 6 7 |
# File 'lib/together/executor.rb', line 5 def mandates @mandates end |
#raise_exceptions ⇒ Object (readonly)
Returns the value of attribute raise_exceptions.
5 6 7 |
# File 'lib/together/executor.rb', line 5 def raise_exceptions @raise_exceptions end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
5 6 7 |
# File 'lib/together/executor.rb', line 5 def results @results end |
#threads ⇒ Object (readonly)
Returns the value of attribute threads.
5 6 7 |
# File 'lib/together/executor.rb', line 5 def threads @threads end |
#timeout_time ⇒ Object (readonly)
Returns the value of attribute timeout_time.
5 6 7 |
# File 'lib/together/executor.rb', line 5 def timeout_time @timeout_time end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 |
# File 'lib/together/executor.rb', line 21 def call execute_mandates wait_for_threads results end |