Chart/GGPlot/HasParams.pm

filter: Statementstmt 100% 33 / 33 Branchbran 62.5% 10 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 89.4% 51 / 57 CC 9 SCAR 12.0
CC
9
Cov
88%
parameters
5.0
_parameters
3.1
extra_params
3.1
CRAP 3.3
« Chart/GGPlot/Scale/Positional.pm ↑ Summary Chart/GGPlot/Range/Continuous.pm »
1 package Chart::GGPlot::HasParams;
2  
3 # ABSTRACT: The role for the 'extra_params' thing
4  
5 7 ▶use Chart::GGPlot::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 7 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 our $VERSION = '0.002003'; # VERSION
9  
10 7 ▶use Types::Standard qw(ArrayRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12  
13  
14 # used by parameters()
15 19 ▶classmethod _parameters() { [] }
Subroutine _parameters: called CC=3 SCAR=11.2
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for classmethod _parameters (expected 1, got ' . @_ . ')') 0 19 19
@_ > 1 and Function::Parameters::_croak('Too many arguments for classmethod _parameters (expected 1, got ' . @_ . ')') 0 19 19
16  
17 16 ▶classmethod extra_params() { [qw(na_rm)] }
Subroutine extra_params: called CC=3 SCAR=11.2
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for classmethod extra_params (expected 1, got ' . @_ . ')') 0 16 16
@_ > 1 and Function::Parameters::_croak('Too many arguments for classmethod extra_params (expected 1, got ' . @_ . ')') 0 16 16
18  
19  
20 # R ggplot2's Geom parameters() function automatically gets params from
21 # draw_panel and draw_group methods via introspection on the method
22 # arguments. Although Perl Function::Parameters supports introspection,
23 # I would now do it in a "dumb" way.
24 22 ▶classmethod parameters( $extra = false ) {
Subroutine parameters: called CC=5 SCAR=16.2
Pod documented
Branch: 3 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for classmethod parameters (expected 1, got ' . @_ . ')') 0 22 22
@_ > 2 and Function::Parameters::_croak('Too many arguments for classmethod parameters (expected 2, got ' . @_ . ')') 0 22 22
@_ < 1 and $extra = &false() 2 20 22
25 22 my $args = $class->_parameters;
26 22 ▶ if ($extra) {
Branch: 1 branch
BranchTrueFalseTotal
if ($extra) 20 2 22
27 20 $args = $args->union( $class->extra_params );
28 }
29 22 return $args;
30 7 }
31  
32 7 1;
33  
34 __END__
« Chart/GGPlot/Scale/Positional.pm ↑ Summary Chart/GGPlot/Range/Continuous.pm »