File Coverage

blib/lib/Bootylicious/ArticleByTagIterator.pm
Criterion Covered Total %
statement 22 22 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 1 2 50.0
total 32 33 96.9


line stmt bran cond sub pod time code
1             package Bootylicious::ArticleByTagIterator;
2              
3 5     5   949 use strict;
  5         16  
  5         206  
4 5     5   26 use warnings;
  5         10  
  5         274  
5              
6 5     5   25 use base 'Bootylicious::Decorator';
  5         8  
  5         821  
7              
8             __PACKAGE__->attr('tag');
9              
10 5     5   613 use Bootylicious::IteratorSearchable;
  5         11  
  5         44  
11              
12             sub new {
13 5     5 1 42 my $self = shift->SUPER::new(@_);
14              
15 5         21 return $self->build;
16             }
17              
18             sub build {
19 5     5 0 8 my $self = shift;
20              
21 5         30 my $tag = $self->tag;
22              
23             return Bootylicious::IteratorSearchable->new($self->object)->find_all(
24             sub {
25 9     9   35 my ($iterator, $elem) = @_;
26              
27 9 100       12 return unless scalar grep { $_ eq $tag } @{$elem->tags};
  19         91  
  9         28  
28              
29 5         27 return $elem;
30             }
31 5         35 );
32             }
33              
34             1;