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 18     18   109 use strict;
  18         41  
  18         478  
4 18     18   117 use warnings;
  18         41  
  18         4088  
5              
6             sub new {
7 92     92 1 181 my $class = shift;
8 92         345 my (%params) = @_;
9              
10 92         176 my $self = {};
11 92         195 bless $self, $class;
12              
13 92         248 $self->{name} = $params{name};
14 92         182 $self->{arguments} = $params{arguments};
15 92         166 $self->{captures} = $params{captures};
16 92         168 $self->{parent} = $params{parent};
17              
18 92         281 return $self;
19             }
20              
21             sub arguments {
22 3     3 1 17 my $self = shift;
23              
24 3         31 return $self->{arguments};
25             }
26              
27 25     25 1 170 sub params { &captures }
28              
29             sub captures {
30 31     31 1 70 my $self = shift;
31              
32 31         63 my $captures = $self->{captures};
33              
34             return $self->parent ? {
35 31 100       73 %{$self->parent->captures},
  3         6  
36             %$captures
37             } : $captures;
38             }
39              
40             sub name {
41 2     2 1 5 my $self = shift;
42              
43 2         9 return $self->{name};
44             }
45              
46             sub parent {
47 36     36 1 66 my $self = shift;
48              
49 36         243 return $self->{parent};
50             }
51              
52             1;
53             __END__