Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

interact with eventmachine code - asynchronously of course

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 .gemspec
Octocat-spinner-32 CHANGELOG.rdoc
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 deps.rip
README.rdoc

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

Something went wrong with that request. Please try again.