An open API service indexing awesome lists of open source software.

https://github.com/cldwalker/ripl-em

interact with eventmachine code - asynchronously of course
https://github.com/cldwalker/ripl-em

Last synced: 8 months ago
JSON representation

interact with eventmachine code - asynchronously of course

Awesome Lists containing this project

README

          

== Description
Run EventMachine code in a ripl shell - asynchronously of course

== Install
Install the gem with:

gem install ripl-em

== Usage

$ ripl em
>> require 'em-http-request'
=> true

>> def get(url); req = EM::HttpRequest.new(url).get; req.callback {|h| puts h.response }; end
=> nil

# Make two requests and watch them return in reverse order
>> get 'http://robolot.herokuapp.com/sleep/10'
=> [#\]
>> get 'http://robolot.herokuapp.com/sleep/1'
=> [#\]
Sir, I slept for 1 second(s). Anything else I can zzz...
Sir, I slept for 10 second(s). Anything else I can zzz...

== Todo
* Autocompletion - Requires an Em::Connection that responds to both newlines and tabs. Any takers? :)
* Basic Readline behavior - Up/Down Arrow -> Previous/Next history
* Retry EM loop if callback raises error