File Coverage

blib/lib/WWW/Shopify/Liquid/Dialect/Shopify/Filter/ProductImgUrl.pm
Criterion Covered Total %
statement 9 16 56.2
branch 0 2 0.0
condition n/a
subroutine 3 6 50.0
pod 0 3 0.0
total 12 27 44.4


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2 1     1   290 use strict;
  1         2  
  1         22  
3 1     1   4 use warnings;
  1         2  
  1         27  
4              
5             # TODO: Write this.
6             package WWW::Shopify::Liquid::Dialect::Shopify::Filter::ProductImgUrl;
7 1     1   5 use base 'WWW::Shopify::Liquid::Filter';
  1         1  
  1         171  
8 0     0 0   sub min_arguments { return 1; }
9 0     0 0   sub max_arguments { return 1; }
10             sub operate {
11 0     0 0   my ($self, $hash, $operand, @arguments) = @_;
12 0 0         return '' unless $operand;
13 0           my $size = $arguments[0];
14 0           $operand =~ s/(\.(jpg|png|jpeg|gif))/_$size$1/i;
15 0           return $operand;
16             }
17              
18             1;