File Coverage

blib/lib/Routes/Tiny/Match.pm
Criterion Covered Total %
statement 26 26 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 6 6 100.0
total 42 42 100.0


line stmt bran cond sub pod time code
1             package Routes::Tiny::Match;
2              
3 17     17   131 use strict;
  17         48  
  17         513  
4 17     17   110 use warnings;
  17         43  
  17         4864  
5              
6             sub new {
7 84     84 1 197 my $class = shift;
8 84         338 my (%params) = @_;
9              
10 84         175 my $self = {};
11 84         193 bless $self, $class;
12              
13 84         255 $self->{name} = $params{name};
14 84         173 $self->{arguments} = $params{arguments};
15 84         158 $self->{captures} = $params{captures};
16 84         170 $self->{parent} = $params{parent};
17              
18 84         289 return $self;
19             }
20              
21             sub arguments {
22 3     3 1 13 my $self = shift;
23              
24 3         26 return $self->{arguments};
25             }
26              
27 25     25 1 187 sub params { &captures }
28              
29             sub captures {
30 31     31 1 68 my $self = shift;
31              
32 31         72 my $captures = $self->{captures};
33              
34             return $self->parent ? {
35 31 100       87 %{$self->parent->captures},
  3         7  
36             %$captures
37             } : $captures;
38             }
39              
40             sub name {
41 2     2 1 7 my $self = shift;
42              
43 2         11 return $self->{name};
44             }
45              
46             sub parent {
47 36     36 1 67 my $self = shift;
48              
49 36         279 return $self->{parent};
50             }
51              
52             1;
53             __END__