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