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 synt
There's http://github.com/alloy/dietrb.
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:
lp
(lookup path) that shows you where a Ruby object gets its methods from (class, superclass etc).inf-ruby
is also good for this.Edit
I forgot Hirb, which is very useful for e.g. showing the results of an ActiveRecord query in a Rails console.
I made a pure Ruby console, inspired off Google Chrome's JavaScript console.
https://github.com/sancarn/RubyConsole
It's still mostly a WIP project as I keep finding bugs with the current algorithm, however I'm building it to be 1.9.3+ compatible.
Use Pry: https://github.com/pry/pry
Let's you:
edit-method obj.my_method
syntaxA tonne more great and original features
What a coincidence. Rubyflow just yesterday announced the irbtools gem, which is a meta-gem containing lots of cool irb enhancement gems. It contains:
wirb
and fancy_irb
ls
, cd
, pwd
, ln_s
, rm
, mkdir
, touch
, cat
ap
, q
, o
, c
, y
, Object#m
, Object#d
ap
– awesome_printq
– like p
, but on one lineObject#m
– ordered method list (takes integer parameter: level of nesting)Object#d
– puts the object, returns self (using tap
)Info, OS, RubyVersion, RubyEngine
OS.windows?
RubyEngine.jruby?
RubyVersion.is.at_least? 1.9
copy
and paste
copy_input
and copy_output
for session historyvim
(or another supported editor) to edit a file, close it and it gets loaded into your current irb session, powered by interactive_editor
olorize('string')
or a file with ray('path')
, powered by coderayhirb
irb
with reset!
or change the Ruby version with the use
method and rvm!
rq:mathn
rrq
Object#ri
helper, powered by ori
!boson
– call commands to get startedThere are nice screenshots on the irbtools page. One nice thing about it is that each of the utilities can stand on its own, in case you just want to cherry-pick one or two features.
2013 Update
Since I wrote this, Pry has become a popular IRB replacement. It doesn't do as much as irbtools
out of the box, but it extensible with plugin gems that add cool features. You can browse source code like it was a unix directory:
pry(main)> cd FileUtils
pry(FileUtils):1> show-method rm
From: /opt/ruby/lib/ruby/1.9.1/fileutils.rb @ line 556:
Number of lines: 10
Owner: FileUtils
def rm(list, options = {})
fu_check_options options, OPT_TABLE['rm']
list = fu_list(list)
fu_output_message "rm#{options[:force] ? ' -f' : ''} #{list.join ' '}" if options[:verbose]
return if options[:noop]
list.each do |path|
remove_file path, options[:force]
end
end
pry(FileUtils):2>
You can also browse Ruby documentation, issue shell commands, and if you're a Rails user, you can use the pry-rails
gem to get pry in your Rails console. There's also a way to hook it into Sinatra and use it with Heroku.
There's ample documentation--there are a bunch of screencasts including a Railscast. It's definitely worth looking into.
Check out ripl, a modular irb alternative which is designed to be extendable. You may also get some answers from Is there something like bpython for Ruby?.