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
- Host: GitHub
- URL: https://github.com/cldwalker/ripl-em
- Owner: cldwalker
- License: mit
- Created: 2011-06-12T18:32:27.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-06-12T18:34:13.000Z (almost 15 years ago)
- Last Synced: 2025-10-08T04:34:56.744Z (8 months ago)
- Language: Ruby
- Size: 79.1 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- Changelog: CHANGELOG.rdoc
- License: LICENSE.txt
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