Karabiner/Rule.pm

filter: Statementstmt 100% 35 / 35 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 33.3% 1 / 3 totaltotal 94.1% 48 / 51 CC 4 SCAR 5.1
CC
4
Cov
97%
_disable_validity_tests
3.0
new
2.0
BEGIN
1.0
CRAP 1.7
« Karabiner/Manipulator/Conditions/Variable_unless.pm ↑ Summary
1 package JSON::Karabiner::Rule ;
2 15 $JSON::Karabiner::Rule::VERSION = '0.008';
3 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use JSON::Karabiner::Manipulator ;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 15 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub new {
9 1 ▶ my $class = shift;
Subroutine new: called CC=2 SCAR=7.0
Pod undocumented
10 1 my $desc = shift;
11 1 ▶ croak 'JSON::Karabiner constructor requires a desc.' if !$desc;
Branch: 1 branch
BranchTrueFalseTotal
unless $desc 0 1 1
12 1 my $self = {
13 description => $desc,
14 manipulators => []
15 };
16 1 bless $self, $class;
17 1 return $self;
18 }
19  
20 sub _disable_validity_tests {
21 2 ▶ my $s = shift;
Subroutine _disable_validity_tests: called CC=3 SCAR=11.0
22 2 my $enable = shift;
23  
24 2 ▶ my $op = $enable ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$enable ? : 1 1 2
25 2 foreach my $manip (@{$s->{manipulators}}) {
26 2 $manip->{_disable_validity_tests} = $op;
27 }
28 }
29  
30 sub _enable_validity_tests {
31 1 ▶ my $s = shift;
Subroutine _enable_validity_tests: called CC=1 SCAR=0.0
32 1 $s->_disable_validity_tests(1);
33 }
34  
35 sub add_manipulator {
36 1 ▶ my $s = shift;
Subroutine add_manipulator: called CC=1 SCAR=0.0
Pod documented
37  
38 1 my $manip = JSON::Karabiner::Manipulator->new($s->{manipulators});
39 1 push @{$s->{manipulators}}, $manip;
40 1 return $manip;
41 }
42  
43 4 ▶sub TO_JSON { return { %{ shift() } }; }
Subroutine TO_JSON: called CC=1 SCAR=0.0
Pod undocumented
44  
45  
46 # ABSTRACT: turns baubles into trinkets
47  
48 15 1;
49  
50 __END__
« Karabiner/Manipulator/Conditions/Variable_unless.pm ↑ Summary