| 1 | # $Id$ | ||||||||||
| 2 | |||||||||||
| 3 | package Google::Chart::Fill::LinearStripes; | ||||||||||
| 4 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Google::Chart::Types; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | with 'Google::Chart::Fill'; | |||||||||
| 9 | |||||||||||
| 10 | subtype 'Google::Chart::Fill::LinearStripes::Angle' | ||||||||||
| 11 | => as 'Num' | ||||||||||
| 12 | 0 | ▶ | => where { $_ >= 0 && $_ <= 90 } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 13 | 0 | ▶ | => message { "Angle spec must be between 0 and 90" } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 14 | 1 | ; | |||||||||
| 15 | |||||||||||
| 16 | 1 | subtype 'Google::Chart::Fill::LinearStripes::StripeList' | |||||||||
| 17 | => as 'ArrayRef[Google::Chart::Fill::LinearStripes::Stripe]' | ||||||||||
| 18 | ; | ||||||||||
| 19 | |||||||||||
| 20 | coerce 'Google::Chart::Fill::LinearStripes::StripeList' | ||||||||||
| 21 | => from 'ArrayRef' | ||||||||||
| 22 | 0 | ▶ | => via { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 23 | 0 | my @list; | |||||||||
| 24 | 0 | foreach my $h (@$_) { | |||||||||
| 25 | 0 | push @list, Google::Chart::Fill::LinearStripes::Strip->new(%$h); | |||||||||
| 26 | } | ||||||||||
| 27 | 0 | return \@list; | |||||||||
| 28 | } | ||||||||||
| 29 | 1 | ; | |||||||||
| 30 | |||||||||||
| 31 | 1 | has 'target' => ( | |||||||||
| 32 | is => 'rw', | ||||||||||
| 33 | isa => enum([ qw(bc c) ]), | ||||||||||
| 34 | required => 1, | ||||||||||
| 35 | ); | ||||||||||
| 36 | |||||||||||
| 37 | 1 | has 'angle' => ( | |||||||||
| 38 | is => 'rw', | ||||||||||
| 39 | isa => 'Google::Chart::Fill::LinearStripes::Angle', | ||||||||||
| 40 | required => 1 | ||||||||||
| 41 | ); | ||||||||||
| 42 | |||||||||||
| 43 | 1 | has 'stripes' => ( | |||||||||
| 44 | is => 'rw', | ||||||||||
| 45 | isa => 'Google::Chart::Fill::LinearStripes::StripeList', | ||||||||||
| 46 | coerce => 1, | ||||||||||
| 47 | required => 1, | ||||||||||
| 48 | auto_deref => 1, | ||||||||||
| 49 | ); | ||||||||||
| 50 | |||||||||||
| 51 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 52 | |||||||||||
| 53 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 54 | 1 | ▶ | no Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub parameter_value { | ||||||||
|
Subroutine
parameter_value: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 57 | 0 | my $self = shift; | |||||||||
| 58 | return join(",", $self->target, 'ls', $self->angle, | ||||||||||
| 59 | 0 | map { $_->as_query } $self->stripes ) | |||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | package | ||||||||||
| 63 | Google::Chart::Fill::LinearStripes::Stripe; | ||||||||||
| 64 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 65 | 1 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 66 | |||||||||||
| 67 | 1 | with 'Google::Chart::QueryComponent'; | |||||||||
| 68 | |||||||||||
| 69 | subtype 'Google::Chart::Fill::LinearStripes::Stripe::Width' | ||||||||||
| 70 | => as 'Num' | ||||||||||
| 71 | 0 | ▶ | => where { $_ > 0 && $_ <= 1 } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 72 | 0 | ▶ | => message { "Stripe width spec must be between 0 and 1" } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 73 | 1 | ; | |||||||||
| 74 | |||||||||||
| 75 | |||||||||||
| 76 | 1 | has 'color' => ( | |||||||||
| 77 | is => 'rw', | ||||||||||
| 78 | isa => 'Google::Chart::Color::Data', | ||||||||||
| 79 | required => 1 | ||||||||||
| 80 | ); | ||||||||||
| 81 | |||||||||||
| 82 | 1 | has 'width' => ( | |||||||||
| 83 | is => 'rw', | ||||||||||
| 84 | isa => 'Google::Chart::Fill::LinearStripes::Strip::Width', | ||||||||||
| 85 | required => 1 | ||||||||||
| 86 | ); | ||||||||||
| 87 | |||||||||||
| 88 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 89 | 1 | ▶ | no Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 90 | |||||||||||
| 91 | 0 | ▶ | sub as_query { | ||||||||
|
Subroutine
as_query: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 92 | 0 | my $self = shift; | |||||||||
| 93 | 0 | return join(',', $self->color, $self->width); | |||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 1 | 1; | |||||||||
| 97 | |||||||||||
| 98 | __END__ | ||||||||||