Name

module Statement

Synopsis

module module_name

  code

end

A module statement defines a module. module_name must be a constant. The defined module is assigned to that constant. If a module of the same name already exists, the features of the new module definition are added to the existing module. module 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.