Singleton Classes
Attribute definitions for a specific object can be made using the class definition construction. Uses for this form of class definition include the definition and a collection of singleton methods.
class <<object
code
end
Creates a virtual class for a specific object, defining the properties (methods and constants) of the class using the class definition construction.
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.