| 1 | # ABSTRACT: document builder - role - links | ||
| 2 | package PONAPI::Document::Builder::Role::HasLinksBuilder; | ||
| 3 | |||
| 4 | 25 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 25 | ▶ | use PONAPI::Document::Builder::Links; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 25 | requires 'add_self_link'; | |
| 9 | |||
| 10 | 25 | has links_builder => ( | |
| 11 | init_arg => undef, | ||
| 12 | is => 'ro', | ||
| 13 | isa => 'PONAPI::Document::Builder::Links', | ||
| 14 | lazy => 1, | ||
| 15 | predicate => 'has_links_builder', | ||
| 16 | builder => '_build_links_builder', | ||
| 17 | handles => [qw[ | ||
| 18 | has_links | ||
| 19 | has_link | ||
| 20 | ]] | ||
| 21 | ); | ||
| 22 | |||
| 23 | 25 | ▶ | sub _build_links_builder { PONAPI::Document::Builder::Links->new( parent => $_[0] ) } |
|
Subroutine
_build_links_builder: called CC=1 SCAR=0.0
| |||
| 24 | |||
| 25 | # NOTE: | ||
| 26 | # These need to be delegated so that they | ||
| 27 | # can return the instance of the Builder | ||
| 28 | # they are attached to and not the Links | ||
| 29 | # Builder itself. | ||
| 30 | # - SL | ||
| 31 | |||
| 32 | 5 | ▶ | sub add_link { |
|
Subroutine
add_link: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 33 | 5 | my ($self, @args) = @_; | |
| 34 | 5 | $self->links_builder->add_link( @args ); | |
| 35 | 5 | return $self; | |
| 36 | } | ||
| 37 | |||
| 38 | 16 | ▶ | sub add_links { |
|
Subroutine
add_links: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 39 | 16 | my ($self, @args) = @_; | |
| 40 | 16 | $self->links_builder->add_links( @args ); | |
| 41 | 16 | return $self; | |
| 42 | } | ||
| 43 | |||
| 44 | 25 | ▶ | no Moose::Role; 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 45 | |||
| 46 | __END__ | ||