lib/Form/Sensible/Field/Toggle.pm

filter: Statementstmt 59.0% 13 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod 100% 3 / 3 totaltotal 56.2% 18 / 32 CC 1 SCAR 5.4
CC
1
Cov
59%
__ANON__
2.0
__ANON__
2.0
get_additional_configuration
2.0
CRAP 1.7
« lib/Form/Sensible/Field/Text.pm ↑ Summary lib/Form/Sensible/Renderer.pm »
1 package Form::Sensible::Field::Toggle;
2  
3 16 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 extends 'Form::Sensible::Field::Select';
6  
7 ## provides a simple on/off field
8  
9 16 has 'on_value' => (
10 is => 'rw',
11 default => 'on',
12 );
13  
14 16 has 'off_value' => (
15 is => 'rw',
16 default => 'off',
17 );
18  
19 has 'on_label' => (
20 is => 'rw',
21 isa => 'Str',
22 lazy => 1,
23 0 ▶ default => sub { ucfirst(shift->on_value)},
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 16 );
25  
26 has 'off_label' => (
27 is => 'rw',
28 isa => 'Str',
29 lazy => 1,
30 0 ▶ default => sub { ucfirst(shift->off_value)},
Subroutine __ANON__: not called CC=1 SCAR=6.9
31 16 );
32  
33  
34 0 ▶sub get_additional_configuration {
Subroutine get_additional_configuration: not called CC=1 SCAR=6.9
Pod documented
35 0 my $self = shift;
36  
37 return {
38 0 map { $_ => $self->$_ }
39 qw/on_value off_value on_label off_label/
40 };
41  
42 }
43  
44 0 ▶sub options {
Subroutine options: not called CC=1 SCAR=6.9
Pod documented
45 0 my $self = shift;
46  
47 return [ {
48 0 name => $self->on_label,
49 value => $self->on_value
50 },
51 {
52 name => $self->off_label,
53 value => $self->off_value
54 },
55 ];
56 }
57  
58 0 ▶sub accepts_multiple {
Subroutine accepts_multiple: not called CC=1 SCAR=6.9
Pod documented
59 0 my $self = shift;
60 0 return 0;
61 }
62  
63 16 __PACKAGE__->meta->make_immutable;
64 16 1;
65  
66 __END__
« lib/Form/Sensible/Field/Text.pm ↑ Summary lib/Form/Sensible/Renderer.pm »