class Concurrent::Promise
def self.aggregate(method, *promises)
returns false.
`true` or executing the composite's `#rescue` handlers if the predicate
then executing the composite's `#then` handlers if the predicate returns
or `one?`) on the collection checking for the success or failure of each,
call the given Ruby `Ennnumerable` predicate (such as `any?`, `all?`, `none?`,
execute the aggregated promises and collect them into a standard Ruby array,
Aggregate a collection of zero or more promises under a composite promise,
def self.aggregate(method, *promises) composite = Promise.new do completed = promises.collect do |promise| promise.execute if promise.unscheduled? promise.wait promise end unless completed.empty? || completed.send(method){|promise| promise.fulfilled? } raise PromiseExecutionError end end composite end