Karabiner/Manipulator/Conditions/Keyboard_type_if.pm

filter: Statementstmt 100% 34 / 34 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 4 totaltotal 85.1% 46 / 54 CC 4 SCAR 4.1
CC
4
Cov
92%
new
2.0
add_keyboard_types
2.0
add_description
2.0
CRAP 1.5
« Karabiner/Manipulator/Conditions/Frontmost_application_if.pm ↑ Summary Karabiner/Manipulator/Conditions/Device_if.pm »
1 package JSON::Karabiner::Manipulator::Conditions::Keyboard_type_if ;
2 1 $JSON::Karabiner::Manipulator::Conditions::Keyboard_type_if::VERSION = '0.018';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use parent 'JSON::Karabiner::Manipulator::Conditions';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod undocumented
10 1 my $class = shift;
11 1 my ($type, $value) = @_;
12 1 my $obj = $class->SUPER::new($type, $value);
13 1 ▶ $obj->{data} = $value || {},
Condition50%1/2
$value || {}
l!l
01
MC/DC0%0/1
$value || {}
$value
Truth table50%1/2
A
A= $value
Aresult
11
00
14 return $obj;
15 }
16  
17 1 ▶sub add_keyboard_types {
Subroutine add_keyboard_types: called CC=2 SCAR=7.0
Pod undocumented
18 1 my $s = shift;
19 1 my @values = @_;
20 1 ▶ croak 'A list of keyboard types is required' unless @values;
Branch: 1 branch
BranchTrueFalseTotal
unless @values 0 1 1
21 1 $s->{data}{keyboard_types} = \@values ;
22 }
23  
24 1 ▶sub add_description {
Subroutine add_description: called CC=2 SCAR=7.0
Pod undocumented
25 1 my $s = shift;
26 1 my $desc = shift;
27 1 ▶ croak ('No description passed.') unless $desc;
Branch: 1 branch
BranchTrueFalseTotal
unless $desc 0 1 1
28 1 $s->{data}{description} = $desc;
29  
30 }
31  
32 1 ▶sub TO_JSON {
Subroutine TO_JSON: called CC=1 SCAR=0.0
Pod undocumented
33 1 my $obj = shift;
34 1 my $name = $obj->{def_name};
35 1 my $value = $obj->{data};
36 1 my %super_hash = (%$value, type => $name);
37 1 return { %super_hash };
38  
39 }
40 #ABSTRACT: definition for keyboard_type_if condition
41  
42 1 1;
43  
44 __END__
« Karabiner/Manipulator/Conditions/Frontmost_application_if.pm ↑ Summary Karabiner/Manipulator/Conditions/Device_if.pm »