Class: Contr::Async::Pool::Base
- Inherits:
-
Object
- Object
- Contr::Async::Pool::Base
- Defined in:
- lib/contr/async/pool.rb
Instance Method Summary collapse
- #create_executor ⇒ Object
- #executor ⇒ Object
- #future(*args, &block) ⇒ Object
- #zip(*futures) ⇒ Object
Instance Method Details
#create_executor ⇒ Object
13 14 15 |
# File 'lib/contr/async/pool.rb', line 13 def create_executor raise NotImplementedError, "pool should implement `#create_executor` method" end |
#executor ⇒ Object
9 10 11 |
# File 'lib/contr/async/pool.rb', line 9 def executor @executor ||= create_executor end |
#future(*args, &block) ⇒ Object
17 18 19 |
# File 'lib/contr/async/pool.rb', line 17 def future(*args, &block) Concurrent::Promises.future_on(executor, *args, &block) end |
#zip(*futures) ⇒ Object
21 22 23 |
# File 'lib/contr/async/pool.rb', line 21 def zip(*futures) Concurrent::Promises.zip_futures_on(executor, *futures) end |