One of the features that is installed when you install Ruby is a program commonly known as IRB. It stands for Interactive Ruby Shell.
IRB allows you to execute small Ruby programs in an interactive way without typing out a full program and all that comes with it. To start IRB, type irb at the command prompt.
Here are a couple of quick examples:
Show an object’s methods
Evaluate a regular expression
Here is a blog post with plenty of other things you can do with irb.