Class: SleepingKingStudios::Docs::Data::ClassObject
Parent Namespace
SleepingKingStudios::Docs::Data
Inherited Classes
SleepingKingStudios::Docs::Data::ModuleObject
>
SleepingKingStudios::Docs::Data::NamespaceObject
>
SleepingKingStudios::Docs::Data::Base
>
Object
Defined In
lib/sleeping_king_studios/docs/data/class_object.rb
Table Of Contents
Overview
Object representing a Ruby class.
Each class can define the following elements:
Defined In files.
inherited classes.
extend-ed modules.
include-ed modules.
Definitions (classes and modules).
Constants.
Class attributes.
Class methods.
A constructor method.
Instance attributes.
Instance methods.
Known subclasses.
Additionally, a class can have a description and metadata tags.
See Also
Back To Top
Constructor
#initialize(native:) => Base
Inherited From
SleepingKingStudios::Docs::Data::Base
Parameters
native (YARD::Tags::Tag) — the YARD object representing the
documented object.
Returns
(Base) — a new instance of Base
Back To Top
Instance Methods
#as_json => Hash{String => Object}
Generates a JSON-compatible representation of the module.
Returns a Hash with the following keys:
‘name’: The full, qualified name of the module.
‘slug’: The name of the module in url-safe format.
‘files’: A list of the files where the module is defined.
‘short_description’: A short description of the module.
‘constructor’: True if the class defines a constructor, otherwise false.
Additionally, the returned Hash will conditionally include the following
keys, if the module 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.
‘description’: The full description of the module, minus the first
clause.
‘extended_modules’: A list of the modules that extend the module.
‘included_modules’: A list of the modules that are included in the
module.
‘instance_attributes’: The instance attributes, if any.
‘instance_methods’: The instance methods, if any.
‘metadata’: Additional metadata tags from the documentation.
Returns
(Hash{String => Object}) — the representation of the module.
#class_attributes => Array<Hash>
Inherited From
SleepingKingStudios::Docs::Data::NamespaceObject
Finds the class attributes defined for the namespace.
For each class attribute, it returns a Hash with the following keys:
‘name’: The name of the attribute.
‘read’: True if the attribute defines a reader method.
‘write’: True if the attribute defines a writer method.
‘path’: The path to the reader method data file, or the writer method
data file if the attribute does not define a reader method.
Returns
(Array<Hash>) — the class attributes.
#class_methods => Array<Hash{String => String}>
Inherited From
SleepingKingStudios::Docs::Data::NamespaceObject
Finds the class methods defined for the namespace.
For each method, it returns a Hash with the following keys:
‘name’: The name of the method, including trailing characters such as
=' or
?’.
‘path’: The path to the method data file.
Returns
(Array<Hash{String => String}>) — the documented class methods.
#constants => Array<String>
Inherited From
SleepingKingStudios::Docs::Data::NamespaceObject
Finds the names of the constants defined under this namespace.
Returns
(Array<String>) — the names of the constants.
#constructor? => Boolean
Returns
(Boolean) — true if the class defines a constructor, otherwise
false.
#data_path => String
Inherited From
SleepingKingStudios::Docs::Data::ModuleObject
The path to the data file.
Returns
(String) — the file path.
#defined_classes => Array<Hash>
Inherited From
SleepingKingStudios::Docs::Data::NamespaceObject
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' }]
Returns
(Array<Hash>) — the defined classes.
#defined_modules => Array<Hash>
Inherited From
SleepingKingStudios::Docs::Data::NamespaceObject
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' }]
Returns
(Array<Hash>) — the defined modules.
#description => String
Inherited From
SleepingKingStudios::Docs::Data::ModuleObject
The full description of the module, minus the first clause.
The remainder of the module description, if any, after subtracting the
short description (separated by the first paragraph break).
Returns
(String) — the remaining description.
See Also
#direct_subclasses => Array<Hash{String => String}>
A list of the direct subclasses of the class.
For each subclass, it returns a Hash with the following keys:
‘name’: The name of the inherited class.
‘slug’: A url-safe, hyphen-separated representation of the name.
‘path’: The path to the data file for the class.
Returns
(Array<Hash{String => String}>) — the direct subclasses.
#extended_modules => Array<Hash{String => String}>
Inherited From
SleepingKingStudios::Docs::Data::ModuleObject
A list of the modules that extend the original module.
For each extending Module, it returns a Hash with the following keys:
‘name’: The name of the extending module.
‘slug’: A url-safe, hyphen-separated representation of the name.
‘path’: The path to the data file for the module.
Returns
(Array<Hash{String => String}>) — the extended modules.
#files => Array<String>
Inherited From
SleepingKingStudios::Docs::Data::ModuleObject
A list of the files where the module is defined.
Returns
(Array<String>) — the list of files.
#included_modules => Array<Hash{String => String}>
Inherited From
SleepingKingStudios::Docs::Data::ModuleObject
A list of the modules that are included in the original module.
For each included Module, it returns a Hash with the following keys:
‘name’: The name of the included module.
‘slug’: A url-safe, hyphen-separated representation of the name.
‘path’: The path to the data file for the module.
Returns
(Array<Hash{String => String}>) — the included modules.
#inherited_classes => Array<Hash{String => String}>
A list of the classes that are inherited by the class.
For each inherited Class, it returns a Hash with the following keys:
‘name’: The name of the inherited class.
‘slug’: A url-safe, hyphen-separated representation of the name.
‘path’: The path to the data file for the class.
Returns
(Array<Hash{String => String}>) — the inherited classes.
#instance_attributes => Array<Hash>
Inherited From
SleepingKingStudios::Docs::Data::NamespaceObject
Finds the instance attributes defined for the namespace.
For each instance attribute, it returns a Hash with the following keys:
‘name’: The name of the attribute.
‘read’: True if the attribute defines a reader method.
‘write’: True if the attribute defines a writer method.
‘path’: The path to the reader method data file, or the writer method
data file if the attribute does not define a reader method.
Returns
(Array<Hash>) — the instance attributes.
#instance_methods => Array<Hash{String => String}>
Inherited From
SleepingKingStudios::Docs::Data::NamespaceObject
Finds the instance methods defined for the namespace.
For each method, it returns a Hash with the following keys:
‘name’: The name of the method, including trailing characters such as
=' or
?’.
‘path’: The path to the method data file.
Returns
(Array<Hash{String => String}>) — the documented instance methods.
Inherited From
SleepingKingStudios::Docs::Data::ModuleObject
Additional metadata tags from the documentation.
#name => String
Inherited From
SleepingKingStudios::Docs::Data::NamespaceObject
The full, qualified name of the namespace.
For the root namespace, should return an empty string. For a Class or a
Module, should return the full name, e.g. “MyGem::MyModule::MyClass”.
Returns
(String) — the qualified name.
#parent_path => String
Inherited From
SleepingKingStudios::Docs::Data::ModuleObject
The path to the defining class or module’s data file.
Returns
(String) — the file path.
#short_description => String
Inherited From
SleepingKingStudios::Docs::Data::ModuleObject
A short description of the module.
The first part of the module description, separated by the first paragraph
break. Typically should fit on a single line of text.
Returns
(String) — the short description.
See Also
#slug => String
Inherited From
SleepingKingStudios::Docs::Data::NamespaceObject
The name of the namespace in url-safe format.
Returns
(String) — the namespace name.
#type => String
Returns
(String) — the type of the namespace.
Back To Top
Back to
Documentation |
Versions |
0.2 |
Reference
|
SleepingKingStudios
|
SleepingKingStudios::Docs
|
SleepingKingStudios::Docs::Data