Google.pm

filter: Statementstmt 100% 27 / 27 Branchbran 83.3% 5 / 6 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 8 / 8 Podpod 25.0% 1 / 4 totaltotal 92.0% 46 / 50 CC 5 SCAR 5.1
CC
5
Cov
97%
BUILDARGS
2.0
has_rule
2.0
BUILD
2.0
CRAP 1.7
« Google/Filter.pm ↑ Summary Google/Parser.pm »
1 package Data::Partial::Google;
2 # ABSTRACT: Filter data structures for "partial responses," Google style
3 2 our $VERSION = '0.02'; # VERSION
4 2 our $AUTHORITY = 'cpan:ARODLAND'; # AUTHORITY
5 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use Data::Partial::Google::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Data::Partial::Google::Filter;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 has rule => (
11 is => 'ro',
12 );
13  
14 has filter => (
15 is => 'ro',
16 lazy => 1,
17 23 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
18 23 Data::Partial::Google::Parser->parse(shift->rule)
19 },
20 2 );
21  
22 # Allow Data::Partial::Google->new("a,b(c/d)")
23 25 ▶sub BUILDARGS {
Subroutine BUILDARGS: called CC=2 SCAR=7.1
Pod undocumented
24 25 my ($class, @args) = @_;
25 25 ▶ unshift @args, "rule" if @args % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @args % 2 25 0 25
26 25 return { @args };
27 }
28  
29 50 ▶sub has_rule {
Subroutine has_rule: called CC=2 SCAR=6.9
Pod undocumented
30 50 my ($self) = @_;
31 50 my $rule = $self->rule;
32 50 ▶ return defined $rule && length $rule;
Condition100%3/3
defined $rule && length $rule
!ll&&!rl&&r
2246
MC/DC100%2/2
defined $rule && length $rule
defined $rule length $rule
Truth table100%3/3
A && B
A= defined $ruleB= length $rule
ABresult
0X0
100
111
33 }
34  
35 25 ▶sub BUILD {
Subroutine BUILD: called CC=2 SCAR=6.9
Pod undocumented
36 25 my ($self) = @_;
37 25 ▶ $self->filter if $self->has_rule;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_rule 23 2 25
38 }
39  
40 25 ▶sub mask {
Subroutine mask: called CC=2 SCAR=6.9
Pod documented
41 25 my ($self, $obj) = @_;
42 25 ▶ if ($self->has_rule) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_rule) { } 23 2 25
43 23 return $self->filter->mask($obj);
44 } else {
45 2 return $obj;
46 }
47 }
48  
49 2 1;
50  
51 __END__
« Google/Filter.pm ↑ Summary Google/Parser.pm »