File Coverage

blib/lib/WWW/Shopify/Liquid/Operator.pm
Criterion Covered Total %
statement 9 34 26.4
branch 0 4 0.0
condition 0 3 0.0
subroutine 3 11 27.2
pod 0 8 0.0
total 12 60 20.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2 30     30   191 use strict;
  30         64  
  30         1041  
3 30     30   128 use warnings;
  30         42  
  30         1001  
4              
5             package WWW::Shopify::Liquid::Operator;
6 30     30   123 use base 'WWW::Shopify::Liquid::Element';
  30         52  
  30         20719  
7             sub new {
8 0     0 0   my $package = shift;
9 0           my $self = bless { line => shift, core => shift, operands => undef }, $package;
10 0 0         $self->{operands} = [@_] if int(@_) >= 1;
11 0           return $self;
12             }
13 0     0 0   sub operands { my $self = shift; $self->{operands} = [@_]; return $self->{operands}; }
  0            
  0            
14              
15 0     0 0   sub tokens { return map { $_->tokens } (@{$_[0]->{operands}}) }
  0            
  0            
16 0     0 0   sub arity { return "binary"; }
17 0     0 0   sub fixness { return "infix"; }
18              
19             sub process {
20 0     0 0   my ($self, $hash, $action, $pipeline) = @_;
21 0           my @ops = @{$self->{operands}};
  0            
22 0           $ops[$_] = $ops[$_]->$action($pipeline, $hash) for (grep { !$self->is_processed($ops[$_]) } (0..$#ops));
  0            
23            
24 0 0 0       if (int(grep { !$self->is_processed($_) } @ops) > 0 && $action eq "optimize") {
  0            
25 0           $self->{operands} = \@ops;
26 0           return $self;
27             }
28 0           $pipeline->security->check_operate($self, $hash, $action, @ops);
29 0           return $self->operate($hash, $action, @ops);
30             }
31 0     0 0   sub priority { return 0; }
32             # If we require a grouping, it means that it must be wrapped in parentheses, due to how Shopify works. Only relevant for reconversion.
33 0     0 0   sub requires_grouping { return 0; }
34              
35             1;