File Coverage

blib/lib/List/Range/Search/Liner.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 25 25 100.0


line stmt bran cond sub pod time code
1             package List::Range::Search::Liner;
2 2     2   970 use strict;
  2         2  
  2         43  
3 2     2   6 use warnings;
  2         2  
  2         47  
4              
5 2     2   5 use Class::Accessor::Lite ro => [qw/ranges/];
  2         2  
  2         9  
6              
7             sub new {
8 1     1 1 6 my ($class, $set) = @_;
9 1         3 return bless {
10             ranges => $set->ranges,
11             } => $class;
12             }
13              
14             sub find {
15 7     7 1 3062 my ($self, $value) = @_;
16              
17 7         7 for my $range (@{ $self->{ranges} }) {
  7         12  
18 20 100       32 return $range if $range->includes($value)
19             }
20              
21             # not found
22 1         3 return undef; ## no critic
23             }
24              
25             1;
26             __END__