File Coverage

blib/lib/WWW/Shopify/Liquid/Optimizer.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 4 50.0
condition n/a
subroutine 7 7 100.0
pod 0 2 0.0
total 29 33 87.8


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3 21     21   97 use strict;
  21         30  
  21         722  
4 21     21   96 use warnings;
  21         29  
  21         491  
5              
6 21     21   103 use WWW::Shopify::Liquid;
  21         30  
  21         578  
7              
8             package WWW::Shopify::Liquid::Optimizer;
9 21     21   87 use base 'WWW::Shopify::Liquid::Pipeline';
  21         32  
  21         7598  
10              
11 23     23 0 172 sub new { return bless { }, $_[0]; }
12              
13 21     21   127 use Clone qw(clone);
  21         30  
  21         2873  
14              
15             sub optimize {
16 2     2 0 1592 my ($self, $hash, $ast) = @_;
17 2 50       10 return undef unless $ast;
18 2         55 my $result = $ast->optimize(clone($hash));
19 2 50       17 return !ref($result) ? WWW::Shopify::Liquid::Token::Text->new(undef, $result) : $result;
20             }
21              
22             1;