Karabiner/Manipulator/Conditions/Device_if.pm untested

filter: Statementstmt 0.0% 0 / 42 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 62 CC 3 SCAR 12.0
CC
3
Cov
0%
add_identifier
6.0
add_description
6.0
new
2.0
CRAP 3.3
1 package JSON::Karabiner::Manipulator::Conditions::Device_if ;
2 $JSON::Karabiner::Manipulator::Conditions::Device_if::VERSION = '0.008';
3 use strict;
4 use warnings;
5 use JSON;
6 use Carp;
7 use parent 'JSON::Karabiner::Manipulator::Conditions';
8  
9 sub new {
10 my $class = shift;
11 my ($type, $value) = @_;
12 my $obj = $class->SUPER::new($type, $value);
13 $obj->{data}{identifiers} = $value || [],
14 return $obj;
15 }
16  
17 sub add_identifier {
18 my $s = shift;
19 my @values = @_;
20 croak 'A value for the identifier name is required' unless @values;
21 my $hash = { @values };
22 #TODO: Validates keys
23 push @{$s->{data}{identifiers}}, $hash;
24  
25 }
26  
27 sub add_description {
28 my $s = shift;
29 my $desc = shift;
30 croak ('No description passed.') unless $desc;
31 $s->{data}{description} = $desc;
32  
33 }
34  
35 sub TO_JSON {
36 my $obj = shift;
37 use Data::Dumper qw(Dumper);
38 my $name = $obj->{def_name};
39 my $value = $obj->{data};
40 print Dumper $value;
41 my %super_hash = (%$value, type => $name);
42 return { %super_hash };
43  
44 }
45 # ABSTRACT: definition for Frontmost_application_if condition
46  
47 1;
48  
49 __END__