class Singleton
A Ruby-specific singleton class.
Definitions
def container?
A singleton class is a container for other definitions.
Signature
-
returns
Boolean
Implementation
def container?
true
end
def nested?
Typically, a singleton class does not contain other definitions.
Signature
-
returns
Boolean
Implementation
def nested?
false
end
def short_form
The short form of the class.
e.g. class << self
.
Implementation
def short_form
"class << #{@name}"
end
def path
The lexical scope as an array of names.
e.g. [:Decode, :Definition]
Signature
-
returns
Array
Implementation
def path
if @path
# Cached version:
@path
else
@path = [*self.absolute_path, *self.path_name]
end
end