lib/WWW/Shopify/Liquid/Dialect/Shopify/Filter/ProductImgUrl.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 27 CC 2 SCAR 11.5
CC
2
Cov
0%
operate
6.0
min_arguments
2.0
max_arguments
2.0
CRAP 3.1
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4  
5 # TODO: Write this.
6 package WWW::Shopify::Liquid::Dialect::Shopify::Filter::ProductImgUrl;
7 use base 'WWW::Shopify::Liquid::Filter';
8 sub min_arguments { return 1; }
9 sub max_arguments { return 1; }
10 sub operate {
11 my ($self, $hash, $operand, @arguments) = @_;
12 return '' unless $operand;
13 my $size = $arguments[0];
14 $operand =~ s/(\.(jpg|png|jpeg|gif))/_$size$1/i;
15 return $operand;
16 }
17  
18 1;