Class: Periodico::Executor
- Inherits:
-
Object
- Object
- Periodico::Executor
- Defined in:
- lib/periodico/executor.rb
Instance Attribute Summary collapse
-
#pool_size ⇒ Object
readonly
Returns the value of attribute pool_size.
Instance Method Summary collapse
- #execute(&block) ⇒ Object
-
#initialize(pool_size:) ⇒ Executor
constructor
A new instance of Executor.
Constructor Details
#initialize(pool_size:) ⇒ Executor
Returns a new instance of Executor.
5 6 7 |
# File 'lib/periodico/executor.rb', line 5 def initialize(pool_size:) @pool_size = pool_size.to_i end |
Instance Attribute Details
#pool_size ⇒ Object (readonly)
Returns the value of attribute pool_size.
3 4 5 |
# File 'lib/periodico/executor.rb', line 3 def pool_size @pool_size end |
Instance Method Details
#execute(&block) ⇒ Object
9 10 11 |
# File 'lib/periodico/executor.rb', line 9 def execute(&block) sync? ? block.call : worker_pool.post(&block) end |