promise.rb for EventMachine

This is an implementation of promise.rb Promises for use with EventMachine.


Add this line to your application's Gemfile:

gem "em_promise.rb"

And then execute:


Or install it yourself as:

gem install em_promise.rb


A promise can be created from a plain ruby value, an EM::Deferrable, or another promise:


You can also resolve a collection of promises, plain values, and EM::Deferrables:


EM:Deferrable is also patched to support common Promise operations directly, or for conversion to a promise:

EM_REDIS.get("key").then { |x| EM_REDIS.get(x) }

See also the docs for promise.rb since every EMPromise inherits from that gem's Promise class.

Getting Help

If you have any questions about this library, or wish to report a bug, please send email to:


If you have code or patches you wish to contribute, the maintainer's preferred mechanism is a git pull request. Push your changes to a git repository somewhere, for example:

git remote rename origin upstream
git remote add origin
git push -u origin master

Then generate the pull request:

git fetch upstream master
git request-pull -p upstream/master origin

And copy-paste the result into a plain-text email to:

You may alternately use a patch-based approach as described on

Contributions follow an inbound=outbound model -- you (or your employer) keep all copyright on your patches, but agree to license them according to this project's COPYING file.