You covered a lot of ground today. Let’s sum it all up:
You looked at the effects of class definitions on self (the default receiver of the methods you call) and on the current class (the default home of the methods you define).
You made acquaintance with Singleton Methods () and singleton classes, gaining new insights into the object model and method lookup.
You added a few new tricks to your bag, including Class Instance Variables (), Class Macros (), and Prepended Wrappers ().
Also remember that today you used the word “class” as a shortcut to “class or module,” and everything you learned about classes can also be applied to modules: the “current class” might actually be a module, a “class instance variable” could well be a “module instance variable,” and so on.
That was quite a deep dive into Ruby’s object model. As the two of you prepare to leave the office, Bill makes a promise that tomorrow will be less talking and more coding. “I’m really looking forward to that,” he says.
. |