Getting started

The first part of the course answers what Ruby is, where a program runs, how to install the interpreter and how to check the version it reports. irb follows, then a first script in a file, a look at the language from the point of view of another language you already know, and the shape of a Ruby program with its classes, methods and blocks.

1.1 What is Ruby and where it runs What Ruby is, where Ruby programs run, and why beginners love the language. Open 1.2 Install Ruby and check the version Install Ruby on Linux, check the version with ruby -v, and run your first gem command. Open 1.3 irb: the interactive shell Open irb, try Ruby expressions line by line, use help and tab completion, and exit cleanly. Open 1.4 Your first Ruby script Create hello.rb, print text with puts, run the file with ruby, and avoid common beginner mistakes. Open 1.5 Ruby from another language What a Python, Perl or Java programmer already knows, how it is spelled in Ruby, and the handful of habits that do not carry over. Open 1.6 irb beyond the prompt The irb features that make it a scratch pad: the _ result, pp for readable dumps, show_source for a method, and loading a file into the session. Open 1.7 How a Ruby program is put together A lib/ and bin/ project, require against require_relative, what -Ilib adds to the load path, and the guard that keeps a file from running when it is required. Open

Lessons