File Coverage

blib/lib/WWW/Shopify/Liquid/Operator.pm
Criterion Covered Total %
statement 23 27 85.1
branch 3 4 75.0
condition n/a
subroutine 9 11 81.8
pod 0 8 0.0
total 35 50 70.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2 37     37   325 use strict;
  37         204  
  37         1142  
3 37     37   222 use warnings;
  37         121  
  37         1462  
4              
5             package WWW::Shopify::Liquid::Operator;
6 37     37   232 use base 'WWW::Shopify::Liquid::Element';
  37         88  
  37         15384  
7             sub new {
8 503     503 0 1190 my $package = shift;
9 503         2434 my $self = bless { line => shift, core => shift, operands => undef }, $package;
10 503 50       2553 $self->{operands} = [@_] if int(@_) >= 1;
11 503         3951 return $self;
12             }
13 0     0 0 0 sub operands { my $self = shift; $self->{operands} = [@_]; return $self->{operands}; }
  0         0  
  0         0  
14 1000     1000 0 3048 sub subelements { qw(operands); }
15              
16 9513     9513 0 39369 sub arity { return "binary"; }
17 0     0 0 0 sub fixness { return "infix"; }
18              
19             sub process {
20 975     975 0 2916 my ($self, $hash, $action, $pipeline) = @_;
21 975         3343 my ($ops) = $self->process_subelements($hash, $action, $pipeline);
22 975 100       2741 return $self unless int(grep { !$self->is_processed($_) } @$ops) == 0;
  1946         5514  
23 968         3441 $pipeline->security->check_operate($self, $hash, $action, @$ops);
24 967         4299 return $self->operate($hash, $action, @$ops);
25             }
26 4845     4845 0 12334 sub priority { return 0; }
27             # If we require a grouping, it means that it must be wrapped in parentheses, due to how Shopify works. Only relevant for reconversion.
28 98     98 0 279 sub requires_grouping { return 0; }
29              
30             1;