Ruby Programming Language
Getting Started with Ruby
By Mark Ciotola
First published on August 23, 2019. Last updated on February 15, 2020.
Ruby is a powerful, yet easy-to-use programming language. It can be used to create simple programs and simulations, as well as highly complicated web applications. In fact, many of the leading websites are programmed with Ruby.
History and Characteristics of Ruby
Computer scientist Yukihiro Matsumoto developed Ruby and first released it in 1995. Ruby draws from Perl, Smalltalk, Eiffel, Ada, and Lisp.  When creating Ruby, Matsumoto strived to develop “a scripting language that was more powerful than Perl, and more object-oriented than Python.”  In fact, Ruby treats everything as an object.  Further, “Ruby is designed to be human-oriented. It reduces the burden of programming. It tries to push jobs back to machines. You can accomplish more tasks with less work, in smaller yet readable code.”  The clean, plain-English code of the Ruby language makes learning its basics easy and intuitive. Beginners can start with a free, 20 minute online course at the Ruby Lang site. . Since Ruby is free, open source software , it is easily affordable for new areas of social science that may not have a large funding base.
There are several conventions we will use in this book.
Programming code mentioned in text will de denoted by
monospacetype. Sometimes they will also be in bold.
Commands entered on the terminal command line shall be monotype after a greater than sign, such as:
> ruby -v
Blocks of programing code will be in their own shaded sections, such as the following, or in areas with line numbers.
# This is a simple Ruby program fruit = "pear" puts fruit.to_s
Output from a program shall be indicated in a shaded area.
Command Line Utility
To use Ruby, the user needs access to their computer’s command line. On Mac OSX, the Terminal application can be used. Console is available for free for Windows. Most Linux applications come with a terminal utility under various names. Or you can use an online Ruby compiler for some somple programs, such as the one from Tutorialspoint.
To run the simulation, the user must also have Ruby installed on their machine (for the examples in this article, preferably Ruby 1.9.2 or higher). Some computers have Ruby pre-installed. To find out if your computer has Ruby and its version, on the command line enter:
If you see something similar to the following, then you already have Ruby installed. If not, you will need to install Ruby. Conversely, you can use this website to run Ruby commands in your web browser, although its capabilities are limited.
ruby 1.9.2p290 (2011−07−09 revision 32553) [x86 64−darwin10.7.1]
Otherwise, you need to download it from the following source and install it: http://www.ruby-lang.org/en/
Alternatively, you can try out Ruby without downloading or installing anything by using an online compiler, such as at Tutorialspoint.
To install Ruby, you will need to go to the downloads site.
- 37Signals, Ruby on Rails. http://rubyonrails.org/, last viewed on 22 March 2013.
- Blanchard, Paul, Robert L. Devaney and Glen R. Hall, 2002, Differential Equations,second edition. Brooks/Cole.
- Ruby-Doc.org, Programming Ruby: The Pragmatic Programmer’s Guide. http://www.ruby-doc.org/docs/ProgrammingRuby/, last viewed on 22 March 2013.
- Ruby-Lang.org, About. http://www.ruby-lang.org/en/about/, last viewed on 22 March 2013.
- Bruce Steward, An Interview with the Creator of Ruby. Addison Wesley, Massachusetts, http://linuxdevcenter.com/pub/a/linux/2001/11/29/ruby.html, last viewed on 25 October 2012.