Generates a JSON-compatible representation of the namespace.
Returns a Hash with the following keys:
‘name’: The full, qualified name of the namespace.
‘slug’: The name of the namespace in url-safe format.
Additionally, the returned Hash will conditionally include the following
keys, if the namespace defines at least one of the corresponding code
objects.
‘class_attributes’: The class attributes, if any.
‘class_methods’: The class methods, if any.
‘constants’: The constants, if any.
‘defined_classes’: The defined Classes, if any.
‘defined_modules’: The defined Modules, if any.
‘instance_attributes’: The instance attributes, if any.
‘instance_methods’: The instance methods, if any.
Returns
(Hash{String => Object}) — the representation of the namespace.
Finds the Classes defined under this namespace, if any.
For each defined Class, it returns a Hash with the following keys:
‘name’: The name of the defined Class.
‘slug’: A url-safe, hyphen-separated representation of the name.
Examples
# Given a class LaunchWindow in the namespace Space::Operations:namespace.name#=> 'Space::Operations'namespace.defined_classes#=> [{ 'name' => 'LaunchWindow', 'slug' => 'launch-window' }]
Finds the Modules defined under this namespace, if any.
For each defined Module, it returns a Hash with the following keys:
‘name’: The name of the defined Module.
‘slug’: A url-safe, hyphen-separated representation of the name.
Examples
# Given a class FuelConsumer in the namespace Space::Engineering:namespace.name#=> 'Space::Engineering'namespace.defined_classes#=> [{ 'name' => 'FuelConsumer', 'slug' => 'fuel-consumer' }]