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   58 use strict;
  17         22  
  17         392  
4 17     17   58 use warnings;
  17         17  
  17         3646  
5              
6             sub new {
7 83     83 1 80 my $class = shift;
8 83         219 my (%params) = @_;
9              
10 83         82 my $self = {};
11 83         104 bless $self, $class;
12              
13 83         148 $self->{name} = $params{name};
14 83         86 $self->{arguments} = $params{arguments};
15 83         89 $self->{captures} = $params{captures};
16 83         83 $self->{parent} = $params{parent};
17              
18 83         184 return $self;
19             }
20              
21             sub arguments {
22 3     3 1 11 my $self = shift;
23              
24 3         18 return $self->{arguments};
25             }
26              
27 25     25 1 126 sub params { &captures }
28              
29             sub captures {
30 31     31 1 37 my $self = shift;
31              
32 31         32 my $captures = $self->{captures};
33              
34             return $self->parent ? {
35 31 100       66 %{$self->parent->captures},
  3         5  
36             %$captures
37             } : $captures;
38             }
39              
40             sub name {
41 2     2 1 3 my $self = shift;
42              
43 2         6 return $self->{name};
44             }
45              
46             sub parent {
47 36     36 1 45 my $self = shift;
48              
49 36         188 return $self->{parent};
50             }
51              
52             1;
53             __END__