class YARD::CodeObjects::Base

Base is the superclass of all code objects recognized by YARD. A code object is any entity in the Ruby language (class, method, module). A DSL might subclass Base to create a new custom object representing a new entity type.

Registry Integration

Any created object associated with a namespace is immediately registered with the registry. This allows the Registry to act as an identity map to ensure that no object is represented by more than one Ruby object in memory. A unique {#path} is essential for this identity map to work correctly.

Custom Attributes

Code objects allow arbitrary custom attributes to be set using the {#[]=} assignment method.

Namespaces

There is a special type of object called a “namespace”. These are subclasses of the {NamespaceObject} and represent Ruby entities that can have objects defined within them. Classically these are modules and classes, though a DSL might create a custom {NamespaceObject} to describe a specific set of objects.

Separators

Custom classes with different separator tokens should define their own separators using the {NamespaceMapper.register_separator} method. The standard Ruby separators have already been defined (‘::’, ‘#’, ‘.’, etc).

@abstract This class should not be used directly. Instead, create a

subclass that implements {#path}, {#sep} or {#type}. You might also
need to register custom separators if {#sep} uses alternate separator
tokens.

@see Registry @see path @see []= @see NamespaceObject @see NamespaceMapper.register_separator