| 1 | package Template::Mustache::Token::Partial; | ||||||||||
| 2 | 23 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||
| 3 | # ABSTRACT: Object representing a Partial block | ||||||||||
| 4 | 23 | $Template::Mustache::Token::Partial::VERSION = '1.3.3'; | |||||||||
| 5 | 23 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 23 | ▶ | use MooseX::MungeHas { has_ro => [ 'is_ro' ], has_rw => [ 'is_rw' ] }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 23 | has_ro 'name'; | |||||||||
| 10 | 23 | has_rw 'indent'; | |||||||||
| 11 | |||||||||||
| 12 | sub render { | ||||||||||
| 13 | 16 | ▶ | my( $self, $context, $partials ) = @_; | ||||||||
|
Subroutine
render: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||
| 14 | |||||||||||
| 15 | 16 | my $partial; | |||||||||
| 16 | |||||||||||
| 17 | 16 | ▶ | if ( ref $partials eq 'CODE' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 11 | ▶ | my $template = $partials->($self->name) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | or return ''; | ||||||||||
| 20 | |||||||||||
| 21 | 11 | ▶ | $partial = ref $template ? $template : Template::Mustache->new( template => $template )->parsed; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | } | ||||||||||
| 23 | else { | ||||||||||
| 24 | 5 | ▶ | $partial = $partials->{$self->name} or return ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 16 | ▶ | if( ref $partial eq 'Template::Mustache' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 7 | $partials = $partial->partials; | |||||||||
| 29 | 7 | $partial = $partial->parsed; | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 16 | return $partial->render( $context, $partials, $self->indent ); | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 23 | 1; | |||||||||
| 36 | |||||||||||
| 37 | __END__ | ||||||||||
| 38 | |||||||||||
| 39 | =pod | ||||||||||
| 40 | |||||||||||
| 41 | =encoding UTF-8 | ||||||||||
| 42 | |||||||||||
| 43 | =head1 NAME | ||||||||||
| 44 | |||||||||||
| 45 | Template::Mustache::Token::Partial - Object representing a Partial block | ||||||||||
| 46 | |||||||||||
| 47 | =head1 VERSION | ||||||||||
| 48 | |||||||||||
| 49 | version 1.3.3 | ||||||||||
| 50 | |||||||||||
| 51 | =head1 AUTHORS | ||||||||||
| 52 | |||||||||||
| 53 | =over 4 | ||||||||||
| 54 | |||||||||||
| 55 | =item * | ||||||||||
| 56 | |||||||||||
| 57 | Pieter van de Bruggen <pvande@cpan.org> | ||||||||||
| 58 | |||||||||||
| 59 | =item * | ||||||||||
| 60 | |||||||||||
| 61 | Yanick Champoux <yanick@cpan.org> | ||||||||||
| 62 | |||||||||||
| 63 | =item * | ||||||||||
| 64 | |||||||||||
| 65 | Ricardo Signes <rjbs@cpan.org> | ||||||||||
| 66 | |||||||||||
| 67 | =back | ||||||||||
| 68 | |||||||||||
| 69 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 70 | |||||||||||
| 71 | This software is copyright (c) 2019, 2018, 2017, 2016, 2015, 2011 by Pieter van de Bruggen. | ||||||||||
| 72 | |||||||||||
| 73 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 74 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 75 | |||||||||||
| 76 | =cut | ||||||||||