EmAlldone

github.com/thoughtless/em_alldone

DESCRIPTION:

Not a genuine Deferrable in that it doesn’t include EM::Deferrable. Callbacks set will be run when all the passed in deferrables have completed with either success or failure. Doesn’t support errbacks.

SYNOPSIS:

A quick example:

require 'eventmachine'
require 'em_alldone'

d1 = EM::DefaultDeferrable.new
d2 = EM::DefaultDeferrable.new
EmAlldone.new(d1, d2) do |arg|
  puts "All done #{arg}"
end
d2.succeed 2 # Nothing happens
d1.succeed 1 # Prints out "All done 2"

d1 = EM::DefaultDeferrable.new
d2 = EM::DefaultDeferrable.new
str = "Hello"
d1.callback do
  str.upcase!
end
EmAlldone.with([d1, d2], str) do |arg|
  puts "All done #{arg}"
end
d2.succeed 2 # Nothing happens
d1.succeed 1 # Prints out "All done HELLO"

REQUIREMENTS:

Although there are no strict requirements, this gem is written to work with Ruby EventMachine and will likely be of little value if you don’t have that gem installed and required.

INSTALL:

gem install em_alldone

RUNNING THE SPECS:

bundle exec rspec spec

TODO:

LICENSE:

(The MIT License)

Copyright © 2012 Poll Everywhere, Paul Cortens

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.