Name
class Statement
Synopsis
classclass_name
[<superclass
]code
end
Defines a class. A
class_name
must be a constant. The defined
class is assigned to that constant. If a class of the same name
already exists, the class and superclass
must match, or the superclass
must not be
specified, in order for the features of the new class definition to
be added to the existing class. class
statements
introduce a new scope for local variables.
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.