Module: MrDarcy::Drivers::Celluloid

Defined in:
lib/mr_darcy/drivers/celluloid.rb

Class Method Summary collapse

Class Method Details

.dispatch(&block) ⇒ Object

Create a new future, and add it to the future stack.


12
13
14
# File 'lib/mr_darcy/drivers/celluloid.rb', line 12

def dispatch(&block)
  futures << ::Celluloid::Future.new(&block)
end

.futuresObject

Returns the future stack.


24
25
26
# File 'lib/mr_darcy/drivers/celluloid.rb', line 24

def futures
  @futures ||= []
end

.waitObject

Iterate the future stack and wait for each to resolve.


17
18
19
20
21
# File 'lib/mr_darcy/drivers/celluloid.rb', line 17

def wait
  futures.each do |future|
    future.value
  end
end