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   911 use strict;
  2         3  
  2         43  
3 2     2   5 use warnings;
  2         1  
  2         44  
4              
5 2     2   6 use Class::Accessor::Lite ro => [qw/ranges/];
  2         1  
  2         9  
6              
7             sub new {
8 1     1 1 11 my ($class, $set) = @_;
9 1         4 return bless {
10             ranges => $set->ranges,
11             } => $class;
12             }
13              
14             sub find {
15 7     7 1 4644 my ($self, $value) = @_;
16              
17 7         10 for my $range (@{ $self->{ranges} }) {
  7         22  
18 20 100       47 return $range if $range->includes($value)
19             }
20              
21             # not found
22 1         6 return undef; ## no critic
23             }
24              
25             1;
26             __END__