Module: Circuitry::Processors::Batcher

Extended by:
Circuitry::Processor
Defined in:
lib/circuitry/processors/batcher.rb

Class Method Summary collapse

Methods included from Circuitry::Processor

flush, on_exit, process

Class Method Details

.flushObject



14
15
16
17
18
# File 'lib/circuitry/processors/batcher.rb', line 14

def flush
  while (block = pool.shift)
    safely_process(&block)
  end
end

.process(&block) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
# File 'lib/circuitry/processors/batcher.rb', line 9

def process(&block)
  raise ArgumentError, 'no block given' unless block_given?
  pool << block
end