IRB: Let’s Bone Up On The Interactive Ruby Shell
The Interactive Ruby Shell, more commonly known as IRB, is one of Ruby's most popular features, especially with new developers. You can bash out a one-liner, try a method you've just learned about, or even build a small algorithm or two without going the whole way to writing a complete program.
I've not posted much about IRB before and it doesn't tend to get a lot of love generally, so while I've been digging through some of the best content I can find on IRB learning all about its internals and ways to get more out of it, I thought I should share:
Demystifying Irb's Commands - An awesome look at the hidden internals, special methods and features within IRB and the impetus for starting this post. Author Gabriel Horner looks at stuff like workspaces, subsessions, and IRB-specific loading methods.
What's Your Favorite IRB Trick? - A list of community-provided IRB tricks and tips on Stack Overflow. Of particular note is the first answer that covers the basic subsession commands (jobs, fg #, and kill #). There are also suggestions for easier benchmarking, predefined data, and using Wirble (mentioned below).
Utility Belt - A "grab-bag of tricks, tools, techniques, trifles, and toys for IRB." There's a ton of useful stuff in here for IRB power users and the feature list is longer than my arm: Amazon S3 support, "with" statement, history buffer, Pastie support, OS X clipboard support, external text editor support, auto-indentation, and more.
irb & script/console tips - A few useful IRB tips and resources from Thoughtbot's Dan Croak. Very practical and code driven. Dan advises loading pp (pretty printer) by default from your .irbrc file.
irb_rocket: An irb plugin - irb_rocket is an add-on for IRB that presents the result of your expression at the end of the current line in a "hash rocket" style.
Rails Console Tricks (screencast) - A screencast by Ryan Bates on the Rails console (a cousin of IRB) featuring a ton of useful tips, some of which are useful to IRB users generally.
Wirble: Tab-Completion and Syntax Coloring for irb - Wirble (homepage) is a Ruby library that adds a number of features to IRB. Of particular interest is its addition of syntax coloring. Install the wirble gem, add a few lines to your .irbrc file, and you get colored results in the data structures coming back from your IRB commands.
IRB documentation from the old Pickaxe - A lengthy page about IRB from the first edition of Programming Ruby (the Pickaxe). Not very up to date but sufficient for Ruby 1.8. Covers command line options, configuration files, and some of the special variables are commands available when running IRB.
Try Ruby - Not got Ruby installed or want to play in an IRB that's not your own? whytheluckystiff's Try Ruby is a great way to play with IRB through a Web browser. It includes an interactive tutorial, too.