blib/lib/Git/Wrapper/Plus/Support/RangeDictionary.pm

filter: Statementstmt 92.3% 48 / 52 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 93.7% 15 / 16 Podpod 100% 4 / 4 totaltotal 89.7% 70 / 78 SCAR 13.9
CC
4
Cov
88%
_dictionary_get
2.0
entry_supports
2.0
_dictionary_ensure_item
2.0
CRAP 4.0
« lib/Git/Wrapper/Plus/Branches.pm ↑ Summary lib/Git/Wrapper/Plus/Support/Arguments.pm »
1 8 ▶use 5.008; # utf8
Subroutine BEGIN: called CC=1 SCAR=0.0
2 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Git::Wrapper::Plus::Support::RangeDictionary;
7 8 $Git::Wrapper::Plus::Support::RangeDictionary::VERSION = '0.004010';
8 # ABSTRACT: A key -> range list mapping for support features
9  
10 8 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
11  
12 8 ▶use Moo qw( has );
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30 8 has 'dictionary' => ( is => ro =>, lazy => 1, builder => 1 );
31  
32 sub _build_dictionary {
33 13 ▶ return {};
Subroutine _build_dictionary: called CC=1 SCAR=0.0
34 }
35  
36 sub _dictionary_set {
37 118 ▶ my ( $self, $name, $set_object ) = @_;
Subroutine _dictionary_set: called CC=1 SCAR=0.0
38 118 $self->dictionary->{$name} = $set_object;
39 118 return $self;
40 }
41  
42 sub _dictionary_get {
43 153 ▶ my ( $self, $name ) = @_;
Subroutine _dictionary_get: called CC=2 SCAR=7.1
44 153 ▶ return unless $self->_dictionary_exists($name);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_dictionary_exists($name) 0 153 153
45 153 return $self->dictionary->{$name};
46 }
47  
48 sub _dictionary_exists {
49 342 ▶ my ( $self, $name ) = @_;
Subroutine _dictionary_exists: called CC=1 SCAR=0.0
50 342 return exists $self->dictionary->{$name};
51 }
52  
53 sub _dictionary_ensure_item {
54 118 ▶ my ( $self, $name ) = @_;
Subroutine _dictionary_ensure_item: called CC=2 SCAR=7.0
55 118 ▶ return if $self->_dictionary_exists($name);
Branch: 1 branch
BranchTrueFalseTotal
if $self->_dictionary_exists($name) 0 118 118
56 118 require Git::Wrapper::Plus::Support::RangeSet;
57 118 $self->_dictionary_set( $name, Git::Wrapper::Plus::Support::RangeSet->new() );
58 118 return;
59 }
60  
61 sub _dictionary_item_add_range_object {
62 0 ▶ my ( $self, $name, $range ) = @_;
Subroutine _dictionary_item_add_range_object: not called CC=1 SCAR=6.9
63 0 $self->_dictionary_ensure_item($name);
64 0 $self->_dictionary_get($name)->add_range_object($range);
65 0 return;
66 }
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87 sub add_range {
88 118 ▶ my ( $self, $name, @args ) = @_;
Subroutine add_range: called CC=1 SCAR=0.0
Pod documented
89 118 $self->_dictionary_ensure_item($name);
90 118 $self->_dictionary_get($name)->add_range(@args);
91 118 return;
92 }
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106 sub has_entry {
107 36 ▶ my ( $self, $name ) = @_;
Subroutine has_entry: called CC=1 SCAR=0.0
Pod documented
108 36 return $self->_dictionary_exists($name);
109 }
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121 sub entries {
122 3 ▶ my ($self) = @_;
Subroutine entries: called CC=1 SCAR=0.0
Pod documented
123 3 my (@entries) = sort keys %{ $self->dictionary };
124 3 return @entries;
125 }
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139 sub entry_supports {
140 35 ▶ my ( $self, $name, $version_object ) = @_;
Subroutine entry_supports: called CC=2 SCAR=7.1
Pod documented
141 35 ▶ return unless $self->_dictionary_exists($name);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_dictionary_exists($name) 0 35 35
142 35 return $self->_dictionary_get($name)->supports_version($version_object);
143 }
144  
145 8 ▶no Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
146  
147 8 1;
148  
149 __END__
« lib/Git/Wrapper/Plus/Branches.pm ↑ Summary lib/Git/Wrapper/Plus/Support/Arguments.pm »