lib/Template/Mustache/Token/Partial.pm

filter: Statementstmt 100% 21 / 21 Branchbran 80.0% 8 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 91.4% 32 / 35 CC 6 SCAR 15.6
CC
6
Cov
94%
render
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.8
« lib/Template/Mustache/Token/Template.pm ↑ Summary lib/Template/Mustache.pm »
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.4.0';
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 16 ▶sub render {
Subroutine render: called CC=6 SCAR=18.0
Pod undocumented
13 16 my( $self, $context, $partials ) = @_;
14  
15 16 my $partial;
16  
17 16 ▶ if ( ref $partials eq 'CODE' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $partials eq 'CODE') { } 11 5 16
18 11 ▶ my $template = $partials->($self->name)
Branch: 1 branch
BranchTrueFalseTotal
my $template = &$partials($self->name) or return "" 11 0 11
19 or return '';
20  
21 11 ▶ $partial = ref $template ? $template : Template::Mustache->new( template => $template )->parsed;
Branch: 1 branch
BranchTrueFalseTotal
ref $template ? : 7 4 11
22 }
23 else {
24 5 ▶ $partial = $partials->{$self->name} or return '';
Branch: 1 branch
BranchTrueFalseTotal
$partial = $$partials{$self->name} or return "" 5 0 5
25 }
26  
27 16 ▶ if( ref $partial eq 'Template::Mustache' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $partial eq "Template::Mustache") 7 9 16
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__
« lib/Template/Mustache/Token/Template.pm ↑ Summary lib/Template/Mustache.pm »