class Documentable::Secondary

Represents a self-contained Perl 6 documentation element.

class Documentable::Secondary is Documentable {}

An instance of this object is used to represent a fragment of documentation found in a Documentable::Primary object. What parts are considered a Documentable::Secondary object? See find-definitions.

Methods

method origin

Defined as

method origin(--> Documentable::Primary)

Returns the Documentable::Primary object where this documentation fragment was found.

method url

Defined as

method url

Returns the URL of its associated HTML file. For instance, if we have a routine (that means, $.kind equal to Kind::Routine), whose name is fff, then it will return /routine/fff.

method url-in-origin

Defined as

method url-in-origin

Returns a URL pointing to the HTML file associated to its origin, with an additional fragment pointing to the exact part where the secondary pod was found.

For instance, if this Documentable::Secondary object was created using a =head2 method new subpod, found in a bigger pod, Any.pod6, this method will return /type/Any#method_new.

method new

Defined as

method new(:$kind!:$name!:@subkinds:@categories:$pod!:$origin)

Creates a new Documentable::Secondary object. You should not create your own instances of this class. Instead of that, you should rely on Documentable::Primary and use its @.defs attribute.

The $pod object is "normalized" when you use this method. That means, its title is modified and headings level are rewritten to avoid style problems.

Type Graph

Type relations for Documentable::Secondary
perl6-type-graph Documentable::Secondary Documentable::Secondary Documentable Documentable Documentable::Secondary->Documentable Any Any Documentable->Any

Expand above chart

Routines supplied by class Documentable

Documentable::Secondary inherits from class Documentable, which provides the following routines:

(Documentable) submethod BUILD

Defined as

submethod BUILD(:$!name:$!kind!:@!subkinds:@!categories:$!pod!)

Returns a Documentable object correctly initialized.

(Documentable) 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.

(Documentable) method kind

Defined as

method kind(--> Kind)

Returns $!kind. See Kind to get more info.

(Documentable) method pod

Defined as

method pod(--> Pod::Block)

Returns $!pod. $!pod is the documentation represented by this object.

(Documentable) method subkinds

Defined as

method subkinds(-->Array[Str])

Returns @!subkinds.

(Documentable) method categories

Returns @!categories. If @!categories is not defined, @!subkinds will be returned instead.

(Documentable) 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␤»