« Karabiner/Manipulator/Actions/To_delayed_if_invoked.pm
↑ Summary
Karabiner/Manipulator/Actions/To_delayed_if_canceled.pm »
| 1 | package JSON::Karabiner::Rule ; | ||||||||||
| 2 | 19 | $JSON::Karabiner::Rule::VERSION = '0.018'; | |||||||||
| 3 | 19 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 19 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 19 | require JSON::Karabiner::Manipulator ; | |||||||||
| 6 | 19 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 28 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 9 | 28 | my $class = shift; | |||||||||
| 10 | 28 | my $desc = shift; | |||||||||
| 11 | 28 | ▶ | croak 'JSON::Karabiner constructor requires a desc.' if !$desc; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 28 | my $self = { | |||||||||
| 13 | description => $desc, | ||||||||||
| 14 | manipulators => [] | ||||||||||
| 15 | }; | ||||||||||
| 16 | 28 | bless $self, $class; | |||||||||
| 17 | 28 | return $self; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 42 | ▶ | sub _disable_validity_tests { | ||||||||
|
Subroutine
_disable_validity_tests: called CC=3 SCAR=11.0
| |||||||||||
| 21 | 42 | my $s = shift; | |||||||||
| 22 | 42 | my $enable = shift; | |||||||||
| 23 | |||||||||||
| 24 | 42 | ▶ | my $op = $enable ? 0 : 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 42 | foreach my $manip (@{$s->{manipulators}}) { | |||||||||
| 26 | 42 | $manip->{_disable_validity_tests} = $op; | |||||||||
| 27 | } | ||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 21 | ▶ | sub _enable_validity_tests { | ||||||||
|
Subroutine
_enable_validity_tests: called CC=1 SCAR=0.0
| |||||||||||
| 31 | 21 | my $s = shift; | |||||||||
| 32 | 21 | $s->_disable_validity_tests(1); | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 27 | ▶ | sub add_manipulator { | ||||||||
|
Subroutine
add_manipulator: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 36 | 27 | my $s = shift; | |||||||||
| 37 | |||||||||||
| 38 | 27 | my $manip = JSON::Karabiner::Manipulator->new_manipulator(); | |||||||||
| 39 | 27 | push @{$s->{manipulators}}, $manip; | |||||||||
| 40 | 27 | return $manip; | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 24 | ▶ | sub TO_JSON { return { %{ shift() } }; } | ||||||||
|
Subroutine
TO_JSON: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 44 | |||||||||||
| 45 | |||||||||||
| 46 | # ABSTRACT: Rule object for holding manipulators | ||||||||||
| 47 | |||||||||||
| 48 | 19 | 1; | |||||||||
| 49 | |||||||||||
| 50 | __END__ | ||||||||||