line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Karabiner::Manipulator::Conditions::Device_if ; |
2
|
|
|
|
|
|
|
$JSON::Karabiner::Manipulator::Conditions::Device_if::VERSION = '0.016'; |
3
|
2
|
|
|
2
|
|
19
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
54
|
|
5
|
2
|
|
|
2
|
|
10
|
use JSON; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
6
|
2
|
|
|
2
|
|
190
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
114
|
|
7
|
2
|
|
|
2
|
|
12
|
use parent 'JSON::Karabiner::Manipulator::Conditions'; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
11
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
2
|
|
|
2
|
0
|
5
|
my $class = shift; |
11
|
2
|
|
|
|
|
6
|
my ($type, $value) = @_; |
12
|
2
|
|
|
|
|
14
|
my $obj = $class->SUPER::new($type, $value); |
13
|
2
|
|
50
|
|
|
24
|
$obj->{data}{identifiers} = $value || [], |
14
|
|
|
|
|
|
|
return $obj; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub add_identifier { |
18
|
2
|
|
|
2
|
0
|
682
|
my $s = shift; |
19
|
2
|
|
|
|
|
5
|
my @values = @_; |
20
|
2
|
50
|
|
|
|
7
|
croak 'A value for the identifier name is required' unless @values; |
21
|
2
|
|
|
|
|
19
|
my $hash = { @values }; |
22
|
|
|
|
|
|
|
#TODO: Validates keys |
23
|
2
|
|
|
|
|
3
|
push @{$s->{data}{identifiers}}, $hash; |
|
2
|
|
|
|
|
11
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub add_description { |
28
|
1
|
|
|
1
|
0
|
323
|
my $s = shift; |
29
|
1
|
|
|
|
|
3
|
my $desc = shift; |
30
|
1
|
50
|
|
|
|
3
|
croak ('No description passed.') unless $desc; |
31
|
1
|
|
|
|
|
5
|
$s->{data}{description} = $desc; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub TO_JSON { |
36
|
4
|
|
|
4
|
0
|
14
|
my $obj = shift; |
37
|
4
|
|
|
|
|
10
|
my $name = $obj->{def_name}; |
38
|
4
|
|
|
|
|
6
|
my $value = $obj->{data}; |
39
|
4
|
|
|
|
|
14
|
my %super_hash = (%$value, type => $name); |
40
|
4
|
|
|
|
|
83
|
return { %super_hash }; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
# ABSTRACT: definition for Frontmost_application_if condition |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |