Project

ripl-em

0.0
No commit activity in last 3 years
No release in over 3 years
Run EventMachine code in a ripl shell - asynchronously of course
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.4.2
 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'
=> [#\<Proc:0x00000101a76848@(ripl):4>]
>> get 'http://robolot.herokuapp.com/sleep/1'
=> [#\<Proc:0x00000101a76848@(ripl):4>]
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