What is Ruby?
Ruby is a cross-platform, interpreted and an object-oriented language. Ruby has been designed on the Principle of Least Surprise - Matz says "I wanted to minimize my frustration during programming, so I want to
minimize my effort in programming. That was my primary goal in designing Ruby.
I want to have fun in programming myself. After releasing Ruby and many people
around the world got to know Ruby, they said they feel the way I feel. They
came up with the phrase the principle of least surprise."
The year 2004 saw a massive surge of
interest in Ruby, with the introduction of the Ruby on Rails Web application
framework by David Heinemeier Hansson.
Yukihiro Matsumoto, commonly known as 'Matz'
created the Ruby language in 1993.
In David Black's book 'Ruby for
Rails', he mentions that a solid grounding in Ruby can serve you, as a Rails
developer, in four ways:
- By helping you know what the code in your
application (including Rails boilerplate code) is doing
- By helping you do more in, and with, your Rails
applications than you can if you limit yourself to the readily available
Rails idioms and techniques (as powerful as those are)
- By allowing you to familiarize yourself with the
Rails source code, which in turn enables you to participate in discussions
about Rails and perhaps even submit bug reports and code patches
- By
giving you a powerful tool for administrative and organization tasks (for example,
legacy code conversion) connected with your application
Downloading Ruby and an Editor
The
simplest way to get Ruby installed on a PC is by using the Ruby Installer for Windows.
Click on ruby185-22.exe. After you have downloaded this, double-click this file
and install Ruby on your PC, accepting all the defaults. After you have
installed your Ruby software, the System Environment Variable path is already
set to point to the bin folder of Ruby.
The
installed Ruby includes the First Edition of Programming Ruby book and the SciTE code editor.
Ruby releases with even subversion numbers -
1.6, 1.8, and so on are stable, public releases.
Do
note that these instructions assume that you are going to use a Windows
platform. For installation on other platforms, you can
refer here, here and here.
Let's assume that you have
installed Ruby in the folder c:/ruby, then the installation creates a number of
sub-folders. The folders:
c:/ruby/bin is where the Ruby executables (including ruby and irb) have
been installed.
c:/ruby/lib/ruby/1.8 you'll find program files written
in Ruby. These files provide standard library facilities, which you can require from your own programs if you
need the functionality they provide.
c:/ruby/lib/ruby/1.8/i386-mswin32 contains architecture-specific
extensions and libraries. The files in this directory generally have names
ending in .so or .dll (depending
on your platform). These files are C-language extensions to Ruby; or, more
precisely, they are the binary, runtime-loadable files generated from Ruby's
C-language extension code, compiled into binary form as part of the Ruby
installation process.
c:/ruby/lib/ruby/site_ruby folder is where you and/or your
system administrator store third-party extensions and libraries. Some of these
may be code you yourself write; others are tools you download from other
people's sites and archives of Ruby libraries.
c:/ruby/lib/ruby/gems is the Ruby-Gems
packaging system (more on this later).
c:/ruby/src is where you
will find the Ruby source code.
c:/ruby/samples/RubySrc-1.8.5/sample is where you will
find some sample Ruby programs.