Classes and Modules
In the previous chapters we have discussed the basics of the Ruby programming language, without looking at it from an object- oriented point of view. Object orientation is an alternative to the procedural method of programming. Procedural code runs from top to bottom in a very simple and linear way. Object-oriented programming includes creating a set of classes, with associated methods (such as a class called Car, with a method called startEngine). We then initialize these classes by creating instance objects of the class in order to call the method.
#!/usr/bin/env rubyclass Car def startEngine puts "Engine Started" ...