
Eloquent Ruby (Addison-Wesley Professional Ruby Series)

You can also write your own classes. You can even modify existing Ruby classes; if you don’t like the behavior of strings or arrays, you can change it. It’s almost always a bad idea to do so, but Ruby allows it.
Joe Leo • The Well-Grounded Rubyist
Understanding self—both the basic fact that such a role is being played by some object at every point in a program and knowing how to tell which object is self—is one of the most vital aspects of understanding Ruby. Another equally vital aspect is understanding scope, to which we’ll turn now.
Joe Leo • The Well-Grounded Rubyist
To understand Ruby programs—both your own and others’—you need to know about Ruby’s notion of a current default object, known by the keyword self.
Joe Leo • The Well-Grounded Rubyist

Designing object-oriented software is largely a matter of figuring out what you want your objects to be: what they should do, how they’ll interact with each other, how many of each there should be (for example, many students, one registrar), and other such questions. As you’ll see, Ruby provides a complete set of tools for naming, creating, address
... See moreJoe Leo • The Well-Grounded Rubyist
Ruby lets you model this way. You can get a lot of mileage out of thinking through your domain as a cascaded, inheritance-based chart of objects. Ruby even provides an is_a? method that tells you whether an object has a given class either as its class or as one of its class’s ancestral classes: >> mag = Magazine.new => #Magazine:0x36289c &
... See more