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.017'; |
3
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
73
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
50
|
|
5
|
2
|
|
|
2
|
|
23
|
use JSON; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
6
|
2
|
|
|
2
|
|
200
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
145
|
|
7
|
2
|
|
|
2
|
|
16
|
use parent 'JSON::Karabiner::Manipulator::Conditions'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
2
|
|
|
2
|
0
|
6
|
my $class = shift; |
11
|
2
|
|
|
|
|
6
|
my ($type, $value) = @_; |
12
|
2
|
|
|
|
|
13
|
my $obj = $class->SUPER::new($type, $value); |
13
|
2
|
|
50
|
|
|
29
|
$obj->{data}{identifiers} = $value || [], |
14
|
|
|
|
|
|
|
return $obj; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub add_identifier { |
18
|
2
|
|
|
2
|
0
|
701
|
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
|
|
|
|
|
6
|
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
|
317
|
my $s = shift; |
29
|
1
|
|
|
|
|
3
|
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
|
9
|
my $obj = shift; |
37
|
4
|
|
|
|
|
9
|
my $name = $obj->{def_name}; |
38
|
4
|
|
|
|
|
6
|
my $value = $obj->{data}; |
39
|
4
|
|
|
|
|
16
|
my %super_hash = (%$value, type => $name); |
40
|
4
|
|
|
|
|
68
|
return { %super_hash }; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
# ABSTRACT: definition for Frontmost_application_if condition |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |