tags:

views:

117

answers:

6

In the python world, there are a number of alternative python interpreters that add cool additional features. One particularly useful example is bpython, which adds dynamic syntax highlighting, automatically pulls documentation, and displays live autocomplete information. In the Ruby world, I have yet to uncover any projects which add to the basic IRB interpreter even a subset of these features. Am I just not looking hard enough, or is this just something the Ruby community is lacking?

+1  A: 

There's not much in the area of alternatives to irb, but there are a couple of gems that add useful features to irb.

Most notably wirble, which, among other things, gives you colored output (not input though) and a history that goes beyond the current session.

sepp2k
wirble giving you irb autocompletion is incorrect. Irb ships with it. wirble just requires it: require 'irb/completion'
@user: Thanks, fixed it.
sepp2k
+1  A: 

There's http://github.com/alloy/dietrb.

Tass
+2  A: 

I've never heard of a (popular) alternative to IRB, but there certainly are several useful gems that make the IRB experience a lot nicer:

  • awesome_print pretty prints Ruby objects with indentation and coloring, very useful when trying to look at nested hashes or other complicated data structures.
  • looksee is pretty awesome too, it provides a method lp (lookup path) that shows you where a Ruby object gets its methods from (class, superclass etc).
  • Sketches connects your editor and IRB, so it's especially useful if you are the type who likes interactive development. Emacs with inf-ruby is also good for this.
  • Wirble is a whole set of IRB enhancements, like tab completion and syntax highlighting. There's also Utility Belt, but I don't personally use that, so can't comment on its features.

Edit

I forgot Hirb, which is very useful for e.g. showing the results of an ActiveRecord query in a Rails console.

Michael Kohl
A: 

You're not looking hard enough or in the right places. This question seems to be a repeat of http://stackoverflow.com/questions/2952793/anything-like-bpython-for-ruby

A: 

JRuby ships with jirb_swing, which provides code completion.

Jörg W Mittag
+6  A: 

What a coincidence. Rubyflow just yesterday announced the irbtools gem, which is a meta-gem containing lots of cool irb enhancement gems. It contains:

Features (pasted from the page):

■Colorized by wirble and put out as comment by irb_rocket
■Nice IRB prompt and IRB’s auto indention (still simple, but still far better than none)
■FileUtils: ls, cd, pwd, ln_s, rm, mkdir, touch, cat
■Many debugging helpers: ap, q, o, c, y, Object#m, Object#d 
■ap – awesome_print
■q – like p, but on one line
■Object#m – ordered method list (takes integer parameter: level of nesting)
■Objedt#d – puts the object, returns self (using tap)
■“Magical” information constants: Info, OS, RubyVersion, RubyEngine 
■OS.windows?
■RubyEngine.jruby?
■RubyVersion.is.at_least? 1.9
■guessmethod automatically corrects typing mistakes or suggests alternative methods (method_missing hook)
■Clipboard features: copy and paste 
■also available: copy_input and copy_output for session history
■Call vim (or another supported editor) to edit a file, close it and it gets loaded into your current irb session, powered by interactive_editor
■Highlight a string with colorize('string') or a file with ray('path'), powered by coderay
■Displays ActiveRecord database entries as tables with hirb
■Restart irb with reset! or change the Ruby version with the use method and rvm!
■Includes the current directory in the load path (was removed in 1.9.2 for security reasons, but is pretty annoying in irb)
■Shorter requiring like this: rq:mathn
■Access to a lot of more commands with boson – call commands to get started

There are nice screenshots on the irbtools page.

Mark Thomas