File Coverage

blib/lib/Chart/Clicker/Positioned.pm
Criterion Covered Total %
statement 9 17 52.9
branch n/a
condition n/a
subroutine 3 7 42.8
pod 4 4 100.0
total 16 28 57.1


line stmt bran cond sub pod time code
1             package Chart::Clicker::Positioned;
2             $Chart::Clicker::Positioned::VERSION = '2.88';
3 11     11   10034 use Moose::Role;
  11         26  
  11         114  
4              
5             # ABSTRACT: Role for components that care about position.
6              
7 11     11   91113 use Moose::Util::TypeConstraints;
  11         32  
  11         135  
8              
9             enum 'Chart::Clicker::Position' => [qw(left right top bottom)];
10              
11              
12             has 'position' => (
13             is => 'rw',
14             isa => 'Chart::Clicker::Position'
15             );
16              
17              
18             sub is_left {
19 0     0 1   my ($self) = @_;
20              
21 0           return $self->position eq 'left';
22             }
23              
24              
25             sub is_right {
26 0     0 1   my ($self) = @_;
27              
28 0           return $self->position eq 'right';
29             }
30              
31              
32             sub is_top {
33 0     0 1   my ($self) = @_;
34              
35 0           return $self->position eq 'top';
36             }
37              
38              
39             sub is_bottom {
40 0     0 1   my ($self) = @_;
41              
42 0           return $self->position eq 'bottom';
43             }
44              
45 11     11   27256 no Moose;
  11         26  
  11         91  
46             1;
47              
48             __END__
49              
50             =pod
51              
52             =head1 NAME
53              
54             Chart::Clicker::Positioned - Role for components that care about position.
55              
56             =head1 VERSION
57              
58             version 2.88
59              
60             =head1 SYNOPSIS
61              
62             package My::Component;
63             use Moose;
64              
65             extends 'Chart::Clicker::Drawing::Component';
66              
67             with 'Chart::Clicker::Positioned';
68              
69             1;
70              
71             =head1 DESCRIPTION
72              
73             Some components draw differently depending on which 'side' they are
74             positioned. If an Axis is on the left, it will put the numbers left and the
75             bar on the right. If positioned on the other side then those two piece are
76             reversed.
77              
78             =head1 ATTRIBUTES
79              
80             =head2 position
81              
82             The 'side' on which this component is positioned.
83              
84             =head1 METHODS
85              
86             =head2 is_left
87              
88             Returns true if the component is positioned left.
89              
90             =head2 is_right
91              
92             Returns true if the component is positioned right.
93              
94             =head2 is_top
95              
96             Returns true if the component is positioned top.
97              
98             =head2 is_bottom
99              
100             Returns true if the component is positioned bottom.
101              
102             =head1 AUTHOR
103              
104             Cory G Watson <gphat@cpan.org>
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108             This software is copyright (c) 2014 by Cold Hard Code, LLC.
109              
110             This is free software; you can redistribute it and/or modify it under
111             the same terms as the Perl 5 programming language system itself.
112              
113             =cut