File Coverage

blib/lib/WWW/Shopify/Liquid/Filter/Eval.pm
Criterion Covered Total %
statement 19 19 100.0
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 0 3 0.0
total 26 30 86.6


line stmt bran cond sub pod time code
1              
2 37     37   15333 use strict;
  37         107  
  37         1084  
3 37     37   228 use warnings;
  37         97  
  37         1411  
4              
5             package WWW::Shopify::Liquid::Filter::Eval;
6 37     37   236 use base 'WWW::Shopify::Liquid::Filter';
  37         102  
  37         8888  
7              
8 2     2 0 14 sub min_arguments { return 0; }
9 4     4 0 26 sub max_arguments { return 0; }
10              
11              
12             sub render {
13 2     2 0 8 my ($self, $renderer, $hash) = @_;
14 2 50       15 my $operand = !$self->is_processed($self->{operand}) ? $self->{operand}->render($renderer, $hash) : $self->{operand};
15            
16 2         11 my $ast = $renderer->parent->parse_text($operand);
17 2         25 my $clone_hash = $renderer->clone_hash;
18 2         10 $renderer->clone_hash(0);
19 2         12 my ($result) = $renderer->render($hash, $ast);
20 2         11 $renderer->clone_hash($clone_hash);
21 2         42 return $result;
22             }
23              
24             1;