« blib/lib/WWW/Shopify/Liquid/Filter/First.pm
↑ Summary
blib/lib/WWW/Shopify/Liquid/Filter/Grep.pm »
| 1 | #!/usr/bin/perl | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | package WWW::Shopify::Liquid::Filter::Last; use base 'WWW::Shopify::Liquid::Filter'; | ||
| 6 | sub transparent { return 1; } | ||
| 7 | sub operate { | ||
| 8 | my ($self, $hash, $operand, @arguments) = @_; | ||
| 9 | return $operand->[-1] if $operand && ref($operand) eq "ARRAY"; | ||
| 10 | return $operand->{last} if $operand && ref($operand) eq "HASH"; | ||
| 11 | return undef; | ||
| 12 | } | ||
| 13 | |||
| 14 | 1; |