RUBY TUTORIAL
Introduction
(2004-10-04)
Ruby is a scripting language that allows the rapid creation of programs to manipulate text, interact with the user and perform operations over the Internet. It offers several advantages over other scripting languages, specifically perl, in that it results in programs that are easier to read and understand, and has a cleaner object model.

This tutorial is intended to provide basic directions on how to get the Ruby interpreter running on a Windows based platform, and is not intended to cover the use or creation of Ruby programs themselves. For more information on Ruby, please see the references at the bottom of this tutorial.

Installation Installing the Ruby software adds a series of programs to your computer that allows it to understand the ruby language. Despite that I have never heard of any problems resulting from installing Ruby, like any other software package, there is a possibility that it may cause problems. Thus, before proceeding, you must agree that you are installing this software at your own risk.

To install Ruby, perform the following steps:

1) Download the Windows installer from http://rubyforge.org/frs/?group_id=167.

Version 1.8.0 or higher is strongly recommended. The size of this file is almost 9 MB, and may take a while to complete over a slower connection such as a dialup modem.

2) Run the installer program you have downloaded. Note that you may need administrative privileges to install, depending on how your Windows system is set up.

After reading the introduction screen and the release notes, the following screen will be displayed:



Figure 1 - Installation Options Dialogue

The scripts provided on this site only require the Base Install. Thus, unless you are planning to use other Ruby programs or embark in Ruby development, it is recommended that you select a "Minimal" install, or uncheck the four displayed optional components.

3) Once you select "Next>", the ruby installer will copy the required files to your computer. Once it has completed the installation process, you may be prompted to restart. At this point, the installation is complete, and you should be ready to use ruby.

Your First Ruby Program Once Ruby is installed, you can test to ensure that it is operating correctly by going to a command shell and typing the following:



Figure 2 - Testing the Ruby Interpreter

Note that ^D represents Control-D, and you must hit return after typing it. This tells the ruby interpreter that you have finished typing in instructions to it.

If the program runs as displayed above, Ruby is now working on your computer.

Using Scripts from this Site In order to use the various scripts provided on this site, perform the following steps:

1) Save the script to your computer as text, with the extension .rb. For example, if the Ruby script was named "test", you would save the file as "test.rb".

2) From the command prompt, in the directory where you have saved the file, run the command "ruby test.rb". If the program requires any additional parameters, it will provide additional instructions at that point with respect to its usage.

Resources The official Ruby site:
http://www.ruby-lang.org/

The Ruby Windows Installer:
http://rubyforge.org/frs/?group_id=167

Please send comments, questions, suggestions and requests to tafyrn@kasuria.com
Last Updated on: 2004-10-04