Class: EM::All
Instance Method Summary collapse
- #<<(d) ⇒ Object
-
#initialize ⇒ All
constructor
A new instance of All.
Constructor Details
#initialize ⇒ All
Returns a new instance of All.
23 24 25 26 27 28 29 30 |
# File 'lib/em/all.rb', line 23 def initialize @defs = [] @errors = [] @results = [] @all_ok = true @any_ok = false @done = 0 end |
Instance Method Details
#<<(d) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/em/all.rb', line 32 def <<(d) @defs << d index = @results.size @results << nil @errors << nil d.callback do |*args| @results[index] = args @any_ok = true check_results end d.errback do |*args| @errors[index] = args @all_ok = false check_results end end |