class Documentable::Registry
Container of all our knowledge.
An instance of this object is used to deal with a collection of Documentable objects. It gives you an API to access all the processed documentation. We can say this class is our source of information.
Methods
method documentables
Defined as
method documentables(--> Array[Documentable::Primary])
Returns an Array
containing all Documentable::Primary objects created.
method definitions
Defined as
method definitions(--> Array[Documentable::Secondary])
Returns an Array
containing all Documentable::Secondary objects created.
method references
Defined as
method references(--> Array[Documentable::Index])
Returns an Array
containing all Documentable::References objects created.
method docs
Defined as
method docs(--> Array[Documentable])
Returns an Array
containing all Documentable objects created. Equivalent to join documentables
, definitions
and references
.
method composed
Defined as
method composed(--> Bool)
Returns a Bool
indicating is the registry is composed.
method tg
Defined as
method tg(--> TypeGraph)
Returns the instance of TypeGraph used to complete the type files.
method routines-by-type
Defined as
method routines-by-type(--> Hash)
Returns a Hash
with the following structure:
key
: name of a type.value
: all Documentable::Secondary objects found in that type.
So, if you have a class Any
, with two methods, method1
and method2
then:
my = (suppose it's correctly initialized);# This will return two Documentable::Secondary objects containing the# definition of method1 and method2.say .routines-by-type<Any>;
method pod-cache
Defined as
method pod-cache(--> Pod::From::Cache)
Returns the the cache object used.
method topdir
Defined as
method topdir(--> Str)
Returns a Str
indicating the directory used as $topdir
.
submethod BUILD
Defined as
submethod BUILD(Str : = "doc", : = [], Bool : = True)
Creates a new instance of the class.
$topdir
: directory containing all the pod6 sources.@dirs
: subdirectories of$topdir
containing pod6 sources.$verbose
: ifTrue
, additional information will be printed.
Example:
use Documentable::Registry;my = Documentable::Registry.new(topdir => "doc", # doc containing the pod collectiondirs => ["Type", "Language"], # dirs to processverbose => True,);# to complete the processing and initialize some attributes.compose;
method add-new
Defined as
method add-new(--> Documentable::Primary)
Adds a new Documentable::Primary object to the registry and returns it.
Warning: if the registry is composed, you cannot add new objects to it.
method load
Defined as
method load(Str : --> Positional[Pod::Block::Named])
Loads a new pod6 file from the cache.
method process-pod-dir
Defined as
method process-pod-dir(Str : --> Array[Documentable::Primary])
Returns an Array
containing all Documentable::Primary objects created after processing the contents of $topdir/$dir
.
method compose
Defined as
method compose(--> Bool)
Compose the registry (initialize
@.docs
and%.routines-by-type
).Returns the new value of
$.composed
.
method lookup
Defined as
method lookup(Str , Str --> Hash)
This method will classify all Documentable objects in the Documentable::Registry
using the attribute $by
and will return all of those whose attribute $by
is set to $what
. These queries are cached the first time they are made, so next calls to this method will be faster.
Example:
my = (... initialize ...)# query all Documentable objects with $.kind# set to Kind::Type.lookup(Kind::Type.Str, :by<kind>)
method docs-for
Defined as
method docs-for(Str )
Returns all Documentable objects with $.name
set to $name
.
Equivalent to .lookup($name, :by<name>)
.