enum Kind
class Documentable {}
This class is the base for Documentable::Primary
and Documentable::Secondary. Everything documented
is represented by a child class of Documentable
.
Methods
submethod BUILD
Defined as
submethod BUILD(:$!name, :$!kind!, :@!subkinds, :@!categories, :$!pod!)
Returns a Documentable
object correctly initialized.
method name
Defined as
method name(--> Str)
Returns $!name
. You must have in mind that this value is not unique, so there could be more than one
Documentable
instance with the same name.
method kind
Defined as
method kind(--> Kind)
Returns $!kind
. See Kind to get more info.
method pod
Defined as
method pod(--> Pod::Block)
Returns $!pod
. $!pod
is the documentation represented by this object.
method subkinds
Defined as
method subkinds(-->Array[Str])
Returns @!subkinds
.
method categories
Returns @!categories
. If @!categories
is not defined, @!subkinds
will
be returned instead.
method english-list
Defined as:
method english-list()
This is a helper method used to convert lists (@.subkinds
) to an "english"
format.
my $doc = Documentable.new(
kind => Kind::Type,
subkinds => ["a", "b"],
pod => []
);
say $doc.english-list # OUTPUT: a and bโคยป
Defined as:
enum Kind is export (Type => "type" , Language => "language",
Programs => "programs" , Syntax => "syntax" ,
Reference => "reference", Routine => "routine" );
Kind::Type
: Complete pod marked with:kind("type")
.Kind::Language
: Complete pod marked with:kind("language")
.Kind::Programs
: Complete pod marked with:kind("programs")
.Kind::Syntax
: Pod fragment from a complete pod.Kind::Routine
: Pod fragment from a complete pod.Kind::Reference
: Element generated viaX<>
.
You can assign the first three values manually, setting the metadata of a pod section as follows:
=begin pod :kind("type") :subkind("class") :category("basic")
(...)
=end pod
Kind::Syntax
and Kind::Routine
are automatically assigned by
Documentable::Primary using
Documentable::Heading::Grammar.