What Is Ruby?
Ruby is a cross-platform, object-oriented, interpreted language that has many features in common with other ‘scripting’ languages such as Perl and Python as well as with ‘pure’ object-oriented languages such as Smalltalk. Its syntax looks deceptively simple at first sight. In fact, Ruby is a good deal more complex than it may appear. The Ruby language was created by Yukihiro Matsumoto (commonly known as ‘Matz’) and it was first released in 1995.
What Is Rails?
Rails is a web development framework (a collection of code libraries and software tools) that uses Ruby as its programming language. It is popularly known as ‘Ruby On Rails’. While Rails is an impressive framework, it is not the be-all and end-all of Ruby. Indeed, if you decide to leap right into Rails development without first mastering Ruby, you may find that you end up with an application that you don’t even understand. The Little Book of Ruby is not about Rails; it concentrates entirely on the Ruby programming language. However, if you intend to program Rails applications, this book will give you the grounding you need in order to understand Rails code and write your own custom Ruby On Rails applications.
Installing Ruby
Before doing anything else, you need to install Ruby on your computer. If you are using Mac OS X (or some versions of Linux) you may already have Ruby installed. At any rate, you can download the latest version of Ruby from www.ruby-lang.org. Be sure to download the binaries (not merely the source code). For Windows users, the easiest way to set up Ruby on your system is by using the Ruby Installer for Windows available from: http://rubyinstaller.org/
Ruby 1 or Ruby 2?
At the time of writing, the latest version of Ruby is Ruby 2.x where ‘x’ represents the minor version numbers used differentiate specific updates to Ruby 2 (e.g. Ruby 2.1.6, Ruby 2.2.2 and so on). Many programmers are still using earlier versions of Ruby, however, such as Ruby 1.8 or 1.9. In most cases, the syntax and behaviour of Ruby 1.x (from at least version 1.8) and Ruby 2.x are identical. That is not to say that there are no important differences but at this stage they need not concern us. In most cases the code described in this book will run identically in Ruby 1.8, 1.9 and 2.x.