Class: EventMachine::Scenario::Multi

Inherits:
Object
  • Object
show all
Includes:
EM::Deferrable
Defined in:
lib/scenario/multi.rb

Overview

Just like with em-http-request

Instance Method Summary collapse

Constructor Details

#initializeMulti

Returns a new instance of Multi.



10
11
12
# File 'lib/scenario/multi.rb', line 10

def initialize
  @actions = 0
end

Instance Method Details

#add(deferable) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/scenario/multi.rb', line 14

def add deferable
  @actions += 1
  deferable.callback do
    @actions -= 1
    self.succeed if @actions == 0
  end
  self
end