Chart/GGPlot/Types.pm

filter: Statementstmt 97.9% 48 / 49 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 94.1% 16 / 17 Podpod n/a totaltotal 94.5% 70 / 74 CC 5 SCAR 3.5
CC
5
Cov
95%
__ANON__
2.1
__ANON__
2.1
__ANON__
2.0
CRAP 1.4
« Chart/GGPlot/Range/Functions.pm ↑ Summary Chart/GGPlot/Position/Fill.pm »
1 package Chart::GGPlot::Types;
2  
3 # ABSTRACT: Custom types and coercions
4  
5 27 ▶use Chart::GGPlot::Setup qw(:base :pdl);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 27 our $VERSION = '0.002003'; # VERSION
8  
9 27 ▶use Ref::Util qw(is_plain_arrayref);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 27 ▶use Type::Library -base, -declare => qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
11 GGParams AesMapping
12 ColorBrewerTypeEnum PositionEnum
13 Theme Margin Labeller
14 Coord Facet Scale
15 HJust VJust
16 27 );
17  
18 27 ▶use Type::Utils -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 27 ▶use Types::Standard -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 27 ▶use Types::PDL -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 27 ▶use Data::Frame::Types qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 27 declare GGParams, as ConsumerOf ["Chart::GGPlot::Params"];
24 coerce GGParams, from HashRef,
25 27 ▶ via { 'Chart::GGPlot::Params'->new($_->flatten); };
Subroutine __ANON__: called CC=1 SCAR=0.0
26  
27 27 declare AesMapping, as InstanceOf ["Chart::GGPlot::Aes"];
28 coerce AesMapping, from HashRef,
29 10 ▶ via { 'Chart::GGPlot::Aes'->new($_->flatten); };
Subroutine __ANON__: called CC=1 SCAR=0.0
30  
31 27 declare ColorBrewerTypeEnum, as Enum [qw(seq dev qual)];
32 27 declare PositionEnum, as Enum [qw(left right top bottom)];
33  
34 27 declare Theme, as InstanceOf["Chart::GGPlot::Theme"];
35  
36 27 declare Margin, as InstanceOf["Chart::GGPlot::Margin"];
37  
38 27 declare Labeller, as InstanceOf["Chart::GGPlot::Labeller"];
39 coerce Labeller, from Any,
40 0 ▶ via { 'Chart::GGPlot::Labeller'->as_labeller($_); };
Subroutine __ANON__: not called CC=1 SCAR=1.2
41  
42 27 declare Coord, as ConsumerOf["Chart::GGPlot::Coord"];
43 27 declare Facet, as ConsumerOf["Chart::GGPlot::Facet"];
44 27 declare Scale, as ConsumerOf["Chart::GGPlot::Scale"];
45  
46 51 ▶declare_coercion "ArrayRefFromAny", to_type ArrayRef, from Any, via { [$_] };
Subroutine __ANON__: called CC=1 SCAR=0.0
47  
48 declare HJust, as(
49 1 ▶ Num->where( sub { $_ > -1e-10 and $_ < 1.0 + 1e-10 } ) | Piddle0D |
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$_ > "-1e-10" and $_ < "1.0000000001" 1 0 1
50 Enum [qw(left right center middle)] | ( ConsumerOf ["PDL::SV"] )->where(
51 7 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
52 7 ( ( $_ == "left" ) | ( $_ == "right" ) | ( $_ == "center" ) |
53 ( $_ == "middle" ) )->all;
54 }
55 ) | Piddle1D->where(
56 3 ▶ sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
57 3 ▶ not $_->$_DOES('PDL::SV')
Branch: 1 branch
BranchTrueFalseTotal
not $_->$Chart::GGPlot::Types::_DOES("PDL::SV") and ($_ > "-1e-10" & $_ < "1.0000000001")->all 1 2 3
58 and ( ( $_ > -1e-10 ) & ( $_ < 1.0 + 1e-10 ) )->all;
59 }
60 )
61 27 );
62 declare VJust, as(
63 1 ▶ Num->where( sub { $_ > -1e-10 and $_ < 1.0 + 1e-10 } ) | Piddle0D |
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$_ > "-1e-10" and $_ < "1.0000000001" 1 0 1
64 Enum [qw(top bottom center middle)] | ( ConsumerOf ["PDL::SV"] )->where(
65 7 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
66 7 ( ( $_ == "top" ) | ( $_ == "bottom" ) | ( $_ == "center" ) |
67 ( $_ == "middle" ) )->all;
68 }
69 ) | Piddle1D->where(
70 3 ▶ sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
71 3 ▶ not $_->$_DOES('PDL::SV')
Branch: 1 branch
BranchTrueFalseTotal
not $_->$Chart::GGPlot::Types::_DOES("PDL::SV") and ($_ > "-1e-10" & $_ < "1.0000000001")->all 1 2 3
72 and ( ( $_ > -1e-10 ) & ( $_ < 1.0 + 1e-10 ) )->all;
73 }
74 )
75 27 );
76  
77 27 1;
78  
79 __END__
« Chart/GGPlot/Range/Functions.pm ↑ Summary Chart/GGPlot/Position/Fill.pm »