OFC2/Labels.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
« OFC2/HBarValues.pm ↑ Summary OFC2/Line.pm »
1 package Chart::OFC2::Labels;
2  
3 =head1 NAME
4  
5 Chart::OFC2::Labels - OFC2 labels object
6  
7 =head1 SYNOPSIS
8  
9 use Chart::OFC2::Labels;
10
11 'x_axis' => Chart::OFC2::XAxis->new(
12 labels => {
13 labels => [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun' ]
14 }
15 ),
16  
17 'x_axis' => Chart::OFC2::XAxis->new(
18 labels => {
19 labels => [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun' ],
20 colour => '#555555',
21 rotate => 45
22 }
23 ),
24  
25 =head1 DESCRIPTION
26  
27 =cut
28  
29 0 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=2.6
30 use Moose::Util::TypeConstraints;
31 use MooseX::StrictConstructor;
32 use MooseX::Aliases;
33  
34 our $VERSION = '0.07';
35  
36 =head1 PROPERTIES
37  
38 has 'labels' => ( is => 'rw', isa => 'ArrayRef', );
39 has 'colour' => ( is => 'rw', isa => 'Str', alias => 'color' );
40 has 'rotate' => ( is => 'rw', isa => 'Num', );
41  
42 =cut
43  
44 has 'labels' => ( is => 'rw', isa => 'ArrayRef', );
45 has 'colour' => ( is => 'rw', isa => 'Str', alias => 'color' );
46 has 'rotate' => ( is => 'rw', isa => 'Num', );
47  
48  
49 =head1 METHODS
50  
51 =head2 new()
52  
53 Object constructor.
54  
55 =head2 TO_JSON()
56  
57 Returns HashRef that is possible to give to C<encode_json()> function.
58  
59 =cut
60  
61 sub TO_JSON {
62 my ($self) = @_;
63
64 return {
65 map { my $v = $self->$_; (defined $v ? ($_ => $v) : ()) }
66 map { $_->name } $self->meta->get_all_attributes
67 };
68 }
69  
70 =head2 color()
71  
72 Same as colour().
73  
74 =cut
75  
76 sub color {
77 &colour;
78 }
79  
80 __PACKAGE__->meta->make_immutable;
81  
82 1;
83  
84  
85 __END__
« OFC2/HBarValues.pm ↑ Summary OFC2/Line.pm »