« Karabiner/Manipulator/Conditions/Input_source_if.pm
↑ Summary
Karabiner/Manipulator/Conditions/Device_unless.pm »
| 1 | package JSON::Karabiner::Manipulator::Conditions::Variable_if ; | ||||||||||||
| 2 | 1 | $JSON::Karabiner::Manipulator::Conditions::Variable_if::VERSION = '0.011'; | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use JSON; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 1 | ▶ | use parent 'JSON::Karabiner::Manipulator::Conditions'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | sub new { | ||||||||||||
| 10 | 2 | ▶ | my $class = shift; | ||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||
| 11 | 2 | my ($type, $value) = @_; | |||||||||||
| 12 | 2 | my $obj = $class->SUPER::new($type, $value); | |||||||||||
| 13 | 2 | ▶ | $obj->{data} = $value || {}, | ||||||||||
|
Condition50%1/2
$value || {}
MC/DC0%0/1
$value || {}
$value
Truth table50%1/2
A
A= $value
| |||||||||||||
| 14 | return $obj; | ||||||||||||
| 15 | } | ||||||||||||
| 16 | |||||||||||||
| 17 | sub add_variable { | ||||||||||||
| 18 | 1 | ▶ | my $s = shift; | ||||||||||
|
Subroutine
add_variable: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||
| 19 | 1 | my $name = shift; | |||||||||||
| 20 | 1 | my $value = shift; | |||||||||||
| 21 | 1 | ▶ | croak 'A variable name is required' unless $name; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 22 | 1 | ▶ | croak 'A value for the varaible name is required' unless $value; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | #TODO: Validates keys | ||||||||||||
| 24 | 1 | $s->{data}{name} = $name; | |||||||||||
| 25 | 1 | $s->{data}{value} = $value; | |||||||||||
| 26 | |||||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | sub add_description { | ||||||||||||
| 30 | 0 | ▶ | my $s = shift; | ||||||||||
|
Subroutine
add_description: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 31 | 0 | my $desc = shift; | |||||||||||
| 32 | 0 | ▶ | croak ('No description passed.') unless $desc; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | 0 | $s->{data}{description} = $desc; | |||||||||||
| 34 | |||||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | sub TO_JSON { | ||||||||||||
| 38 | 2 | ▶ | my $obj = shift; | ||||||||||
|
Subroutine
TO_JSON: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 39 | 2 | my $name = $obj->{def_name}; | |||||||||||
| 40 | 2 | my $value = $obj->{data}; | |||||||||||
| 41 | 2 | my %super_hash = (%$value, type => $name); | |||||||||||
| 42 | 2 | return { %super_hash }; | |||||||||||
| 43 | |||||||||||||
| 44 | } | ||||||||||||
| 45 | # ABSTRACT: definition for Frontmost_application_if condition | ||||||||||||
| 46 | |||||||||||||
| 47 | 1 | 1; | |||||||||||
| 48 | |||||||||||||
| 49 | __END__ | ||||||||||||