If you want to play with Ruby, there is a facility called Interactive
Ruby---irb, for short.
irb is essentially a Ruby ``shell'' similar in
concept to an operating system shell (complete with job control). It
provides an environment where you can ``play around'' with the
language in real time. You launch irb at the command prompt:
irb will display the value of each expression as you complete it. For
a = 1 +
2 * 3 /
4 % 5
puts "Hello, world!"
irb also allows you to create subsessions, each one of which may have
its own context. For example, you can create a subsession with the
same (top-level) context as the original session, or create a
subsession in the context of a particular class or instance. The
sample session shown in Figure 12.1 on page 126 is a bit longer,
but shows how you can create subsessions and switch between them.
For a full description of all the commands that irb supports, see
the reference beginning on page 517.
As with the debugger, if your version of Ruby was built with GNU
Readline support, you can use arrow keys (as with Emacs) or vi-style
key bindings to edit individual lines or to go back and reexecute or
edit a previous line---just like a command shell.
irb is a great learning tool: it's very handy if you want to try out
an idea quickly and see if it works.