File Coverage

blib/lib/WWW/Shopify/Liquid/Tag/Enclosing.pm
Criterion Covered Total %
statement 25 30 83.3
branch 3 10 30.0
condition 1 3 33.3
subroutine 11 13 84.6
pod 0 10 0.0
total 40 66 60.6


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2 37     37   98162 use strict;
  37         104  
  37         1051  
3 37     37   218 use warnings;
  37         87  
  37         1298  
4              
5             package WWW::Shopify::Liquid::Tag::Enclosing;
6 37     37   227 use base 'WWW::Shopify::Liquid::Tag';
  37         100  
  37         21507  
7 1028 50   1028 0 2935 sub abstract { my $package = ref($_[0]) ? ref($_[0]) : $_[0]; return ($package eq __PACKAGE__); }
  1028         3846  
8 1886     1886 0 7578 sub is_enclosing { return 1; }
9 636     636 0 3206 sub inner_tags { return (); }
10 371     371 0 1454 sub inner_ignore_whitespace { return 0; }
11             # Interprets the inner of this tag as being completely text. Used for comments and raws.
12 773     773 0 4376 sub inner_halt_lexing { return 0; }
13 3     3 0 15 sub subelements { qw(contents arguments) }
14              
15             sub new {
16 32     32 0 136 my ($package, $line, $tag, $arguments, $contents) = @_;
17 32         108 my $self = { line => $line, core => $tag, arguments => $arguments, contents => @{$contents->[0]} };
  32         181  
18 32 50       158 die new WWW::Shopify::Liquid::Exception::Parser($self, "Uncustomized tags can only have one element following their contents.") unless int(@$contents) == 1;
19 32         410 return bless $self, $package;
20             }
21              
22 0 0   0 0 0 sub strip_left_end { $_[0]->{strip_left_end} = $_[1] if @_ > 1; return $_[0]->{strip_left_end}; }
  0         0  
23 0 0   0 0 0 sub strip_right_end { $_[0]->{strip_right_end} = $_[1] if @_ > 1; return $_[0]->{strip_right_end}; }
  0         0  
24              
25              
26             sub process {
27 2     2 0 10 my ($self, $hash, $action, $pipeline) = @_;
28 2         23 my ($contents, $arguments) = $self->process_subelements($hash, $action, $pipeline);
29 2 50 33     14 return $self unless $self->is_processed($contents) && int(grep { !$self->is_processed($_) } @$arguments) == 0;
  0         0  
30 2         18 return $self->operate($hash, $contents, @$arguments);
31             }
32              
33             1;