Objects, Classes, Methods

We’ve talked about objects quite a bit now, merely using that term as a synomym for “things”. You’ve learned to do stuff with simple objects such as numbers and Strings, and the data structures Arrays and Hashes. You’ve also learned what a method is, how to define and use them, and how to pass things to them, and get others back.

We’re also prepared well enough to have a closer look at objects, classes (types of things) and methods, and how they relate to each other.

As a sidenote, you may have heard the following. Rubyist love saying it:

In Ruby everything is an object.

Actually, this is a little bit of a lie. Even though it’s being said so often, it isn’t completely true: not everything is an object. There are a few things that are not objects.

But almost everything is, and that’s good enough to know for now.

In Ruby almost everything is an object :)

(Just in case you want to out-smart people at your local Ruby user group though, remember to ask “Really? Is an if statement an object or a method? How about self?”)