class Module
A Ruby-specific module.
Definitions
def initialize(*arguments, **options)
Initialize a module with its name and options.
Implementation
def initialize(*arguments, **options)
super(*arguments, **options)
@includes = []
@extends = []
@prepends = []
end
attr :includes
Signature
-
attribute
Array(Symbol) Modules included into this module.
attr :extends
Signature
-
attribute
Array(Symbol) Modules extended into this module (adds singleton methods).
attr :prepends
Signature
-
attribute
Array(Symbol) Modules prepended into this module (method lookup precedence).
def container?
A module is a container for other definitions.
Implementation
def container?
true
end
def short_form
The short form of the module.
e.g. module Barnyard.
Implementation
def short_form
"module #{self.name}"
end
def long_form
Generate a long form representation of the module.
Implementation
def long_form
qualified_form
end
def qualified_form
The fully qualified name of the module.
e.g. module ::Barnyard::Dog.
Implementation
def qualified_form
"module #{self.qualified_name}"
end