File Coverage

blib/lib/WWW/Shopify/Liquid/Dialect.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition 2 3 66.6
subroutine 6 6 100.0
pod 0 3 0.0
total 28 32 87.5


line stmt bran cond sub pod time code
1             package WWW::Shopify::Liquid::Dialect;
2              
3 3     3   27 use strict;
  3         9  
  3         103  
4 3     3   22 use warnings;
  3         11  
  3         87  
5 3     3   20 use Module::Find;
  3         9  
  3         1010  
6              
7 2     2 0 1710 sub new { return bless { }, $_[0]; }
8              
9             sub use_modules {
10 3     3 0 12 my ($self, $package) = @_;
11 3   66     33 return useall($package || ref($self) || $self);
12             }
13              
14             sub apply {
15 3     3 0 13 my ($self, $liquid, $package) = @_;
16            
17 3         29 my @modules = $self->use_modules($package);
18            
19 3         4696 $liquid->register_operator($_) for (grep { $_ =~ m/\bOperator\b/ } @modules);
  46         79  
20 3         6 $liquid->register_filter($_) for (grep { $_ =~ m/\bFilter\b/ } @modules);
  46         106  
21 3         11 $liquid->register_tag($_) for (grep { $_ =~ m/\bTag\b/ } @modules);
  46         115  
22             }
23              
24             1;