File Coverage

blib/lib/App/AquariumHive/Plugin/AqHive/State.pm
Criterion Covered Total %
statement 4 11 36.3
branch 0 2 0.0
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 6 19 31.5


line stmt bran cond sub pod time code
1             package App::AquariumHive::Plugin::AqHive::State;
2             BEGIN {
3 1     1   1342 $App::AquariumHive::Plugin::AqHive::State::AUTHORITY = 'cpan:GETTY';
4             }
5             $App::AquariumHive::Plugin::AqHive::State::VERSION = '0.002';
6 1     1   4 use Moo;
  1         1  
  1         5  
7              
8             our @attributes;
9              
10             for my $pwm_no (1..6) {
11             my $pwm_step = 'pwm'.$pwm_no.'_step';
12             push @attributes, $pwm_step;
13             has $pwm_step, (
14             is => 'rw',
15             );
16             }
17              
18             sub data {
19 0     0 0   my ( $self ) = @_;
20 0           return {map {
21 0           $_, $self->$_()
22             } @attributes};
23             }
24              
25             sub update {
26 0     0 0   my ( $self, $data ) = @_;
27 0           for (@attributes) {
28 0 0         $self->$_($data->{$_}) if defined $data->{$_};
29             }
30 0           return $self;
31             }
32              
33             1;
34              
35             __END__
36              
37             =pod
38              
39             =head1 NAME
40              
41             App::AquariumHive::Plugin::AqHive::State
42              
43             =head1 VERSION
44              
45             version 0.002
46              
47             =head1 DESCRIPTION
48              
49             B<IN DEVELOPMENT, DO NOT USE YET>
50              
51             See L<http://aquariumhive.com/> for now.
52              
53             =head1 SUPPORT
54              
55             IRC
56              
57             Join #AquariumHive on irc.freenode.net. Highlight Getty for fast reaction :).
58              
59             Repository
60              
61             https://github.com/homehivelab/aquariumhive
62             Pull request and additional contributors are welcome
63              
64             Issue Tracker
65              
66             https://github.com/homehivelab/aquariumhive/issues
67              
68             =head1 AUTHOR
69              
70             Torsten Raudssus <torsten@raudss.us>
71              
72             =head1 COPYRIGHT AND LICENSE
73              
74             This software is copyright (c) 2014 by Torsten Raudssus.
75              
76             This is free software; you can redistribute it and/or modify it under
77             the same terms as the Perl 5 programming language system itself.
78              
79             =cut