File Coverage

blib/lib/Path/Dispatcher/Rule/CodeRef.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 17 17 100.0


line stmt bran cond sub pod time code
1             package Path::Dispatcher::Rule::CodeRef;
2             # ABSTRACT: predicate is any subroutine
3              
4             our $VERSION = '1.07';
5              
6 31     31   221 use Moo;
  31         75  
  31         180  
7              
8 31     31   9878 use Types::Standard qw(CodeRef);
  31         95  
  31         273  
9             extends 'Path::Dispatcher::Rule';
10              
11             has matcher => (
12             is => 'ro',
13             isa => CodeRef,
14             required => 1,
15             );
16              
17             sub _match {
18 3     3   9 my $self = shift;
19 3         6 my $path = shift;
20              
21 3         7 local $_ = $path;
22 3         15 return $self->matcher->($path);
23             }
24              
25             __PACKAGE__->meta->make_immutable;
26 31     31   18824 no Moo;
  31         92  
  31         138  
27              
28             1;
29              
30             __END__