Chart/WithLinearGradientFill.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 40 CC 1 SCAR 6.9
CC
1
Cov
0%
add_linear_gradient_fill
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Google::Chart::WithLinearGradientFill;
2 use Moose::Role;
3 use namespace::clean -except => qw(meta);
4  
5 # Current spec doesn't allow for multiple gradient fills, but
6 # who knows... so making this a separate object so we can just change this
7 # from 'Object' to 'ArrayRef[Object]'
8 has linear_gradient_fill => (
9 is => 'ro',
10 isa => 'Google::Chart::LinearGradientFill',
11 writer => '_set_linear_gradient_fill',
12 );
13  
14  
15 sub add_linear_gradient_fill {
16 my ($self, @args) = @_;
17  
18 $self->_set_linear_gradient_fill(Google::Chart::LinearGradientFill->new(@args));
19 }
20  
21 around prepare_query => sub {
22 my ($next, $self, @args) = @_;
23 my @query = $next->($self, @args);
24  
25 my $fill = $self->linear_gradient_fill;
26 if ($fill) {
27 push @query, (chf =>
28 join(',', $fill->type, 'lg', $fill->angle,
29 join(',', @{$fill->colors})
30 )
31 );
32 }
33  
34 return @query;
35 };
36  
37 package #
38 Google::Chart::LinearGradientFill;
39 use Moose;
40 use Moose::Util::TypeConstraints;
41 use namespace::clean -except => qw(meta);
42  
43 has type => (
44 is => 'ro',
45 isa => enum([ qw(c bg) ]),
46 required => 1,
47 );
48  
49 has angle => (
50 is => 'ro',
51 isa => 'Int',
52 required => 1,
53 );
54  
55 has colors => (
56 is => 'ro',
57 isa => 'ArrayRef',
58 required => 1,
59 );
60
61 1;