Karabiner/Manipulator/Actions.pm

filter: Statementstmt 100% 34 / 34 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 3 / 3 totaltotal 96.1% 50 / 52 CC 4 SCAR 4.1
CC
4
Cov
95%
add_pointing_button
2.0
_is_exclusive
2.0
add_consumer_key_code
2.0
CRAP 1.5
« Karabiner/Manipulator/Conditions/Device_if.pm ↑ Summary Karabiner/Manipulator/Actions/To_after_key_up.pm »
1 package JSON::Karabiner::Manipulator::Actions ;
2 13 $JSON::Karabiner::Manipulator::Actions::VERSION = '0.018';
3 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 13 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 29 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
9 29 my $class = shift;
10 29 my $type = shift;
11  
12 29 my $self = {
13 def_name => $type,
14 consumer_key_code => 0,
15 pointing_button => 0,
16 key_code => 0,
17 any => 0,
18 last_key_code => '',
19  
20 };
21 29 bless $self, $class;
22 {
23 13 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
24 29 $main::current_action = $self;
25 }
26 29 return $self;
27 }
28  
29 9 ▶sub add_consumer_key_code {
Subroutine add_consumer_key_code: called CC=2 SCAR=6.9
Pod documented
30 9 my $s = shift;
31 9 ▶ croak 'You must pass a value' if !$_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] 1 8 9
32 8 $s->add_key_code(@_, 'consumer_key_code');
33 }
34  
35 7 ▶sub add_pointing_button {
Subroutine add_pointing_button: called CC=2 SCAR=7.1
Pod documented
36 7 my $s = shift;
37 7 ▶ croak 'You must pass a value' if !$_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] 0 7 7
38 7 $s->add_key_code(@_, 'pointing_button');
39 }
40  
41 103 ▶sub _is_exclusive {
Subroutine _is_exclusive: called CC=2 SCAR=7.0
42 103 my $s = shift;
43 103 my $property = shift;
44 103 ▶ croak 'No property passed' unless $property;
Branch: 1 branch
BranchTrueFalseTotal
unless $property 0 103 103
45 # my $is_exclusive = !grep { !$s->{$_} unless $_ eq $property } qw(shell_command select_input_source set_variable mouse_key consumer_key_code pointing_button key_code);
46 # croak 'Property already set that conflicts with the propert you are trying to set' unless $is_exclusive;
47 103 $s->{$property} = 1;
48 }
49  
50  
51 # ABSTRACT: parent class for action classes
52  
53 13 1;
54  
55 __END__
« Karabiner/Manipulator/Conditions/Device_if.pm ↑ Summary Karabiner/Manipulator/Actions/To_after_key_up.pm »