LiterallyPromise
Stolen promise implementation from @tenderlove's talk at MWRC 2014.
Installation
Add this line to your application's Gemfile:
gem 'literally_promise'
And then execute:
$ bundle
Or install it yourself as:
$ gem install literally_promise
Usage
require 'literally_promise'
LiterallyPromise::Promise.new do
puts "omg"
end
Advanced Usage
require 'literally_promise'
my_promise = LiterallyPromise::Promise.new do
puts "omg it's starting"
sleep 10
2 * 2
end
Check the status of a promise:
my_promise.alive?
my_promise.stop?
my_promise.status
my_promise.raise
my_promise.value
my_promise.kill
Contributing
- Fork it ( http://github.com/fivetanley/literally_promise/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request