3 Matching Annotations
- Apr 2021
It seems inelegant to me to split this into two different modules, one to include, the other to extend.
the key thing (one of them) to understand here is that: class methods are singleton methods
- Ruby: singleton methods
- Ruby: modules
- programming languages: learning/understanding the subtleties
- Ruby: class methods
- depends on how you look at it
Apparently when you create a subclass, that subclass's singleton class has # its superclass's singleton class as an ancestor.
This is a good thing. It allows class methods to be inherited by subclasses.
Class Methods Are Singleton MethodsSince in Ruby classes are objects as well, class methods are merely methods defined on a specific instance of Class.