blib/lib/CXC/Gnuplot/V0/Timestamp.pm

filter: Statementstmt 68.3% 41 / 60 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 64.7% 11 / 17 Podpod 100% 4 / 4 totaltotal 48.2% 56 / 116 CC 16 SCAR 33.2
CC
16
Cov
45%
to_hash
56.0
opts
56.0
__ANON__
20.0
CRAP 27.5
« blib/lib/CXC/Gnuplot/V1/Util.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/TermOptions.pm »
1 package CXC::Gnuplot::V0::Timestamp;
2  
3 1 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use experimental 'builtin', 'declared_refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Feature::Compat::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = 'v0.29.3';
8  
9 class CXC::Gnuplot::V0::Timestamp;
10  
11 1 ▶use builtin 'is_bool', 'true', 'false';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶no namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Ref::Util 'is_plain_hashref', 'is_plain_arrayref', 'is_ref';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use List::Util 'none';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 use CXC::Gnuplot::V0::Types -lexical, qw(
21 Enum
22 is_Num
23 CoordOffset2D
24 SetFormats
25  
26 signature_for
27 1 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 use CXC::Gnuplot::V0::Util -lexical, 'maybe_quote', 'assert_coerce_object', 'clone_object',
29 1 ▶ 'pvalidate', 'to_hash_r', 'render_opts', 'render_set';
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use CXC::Gnuplot::V0::AxisFormat;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32  
33 my sub croak {
34 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
35 0 goto \&Carp::croak;
36 }
37  
38 #<<< no tidy
39 1 field $format :param :reader = undef; #
40 1 field $where :param :reader = undef; # {top | bottom}
41 1 field $rotate :param :reader = undef; # {{no}rotate {by <ang>}}
42 1 field $offset :param :reader = undef; # {offset <offset> }
43 1 field $font :param :reader = undef; # {"name{,<size>}"}
44 1 field $textcolor :param :reader = undef; # {colorspec}
45 #>>>
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67 ADJUST {
68  
69 0 ▶ pvalidate( format => Str => \$format );
Subroutine __ANON__: not called CC=4 SCAR=30.0
70  
71 0 pvalidate( where => Enum->of( 'top', 'bottom' ), \$where );
72  
73 0 ▶ defined $rotate
Branch: 1 branch
BranchTrueFalseTotal
defined $rotate and not builtin::is_bool($rotate) and not is_Num $rotate and croak "\"rotate\" must be a float or a boolean" 0 0 0
Condition0%0/6
defined $rotate and not builtin::is_bool($rotate) and not is_Num $rotate
!ll&&!rl&&r
000
defined $rotate and not builtin::is_bool($rotate)
!ll&&!rl&&r
000
MC/DC0%0/3
defined $rotate and not builtin::is_bool($rotate) and not is_Num $rotate
defined $rotate not builtin::is_bool($rotate) not is_Num $rotate
Truth table0%0/4
A and not(B) and not(C)
A= defined $rotateB= not builtin::is_bool($rotate)C= not is_Num $rotate
ABCresult
0XX0
10X0
1100
1111
74 and !is_bool( $rotate )
75 and !is_Num( $rotate )
76 and croak( '"rotate" must be a float or a boolean' );
77  
78 0 pvalidate( offset => CoordOffset2D, \$offset );
79 0 pvalidate( font => Font => \$font );
80 0 pvalidate( textcolor => ColorSpec => \$textcolor );
81 }
82  
83  
84  
85  
86  
87 method to_hash {
88  
89 0 ▶ to_hash_r( {
Subroutine to_hash: not called CC=7 SCAR=40.3
Pod documented
Branch: 6 branches
BranchTrueFalseTotal
defined $format ? : 0 0 0
defined $where ? : 0 0 0
defined $rotate ? : 0 0 0
defined $offset ? : 0 0 0
defined $font ? : 0 0 0
defined $textcolor ? : 0 0 0
90 ( defined $format ? ( format => $format ) : () ),
91 ( defined $where ? ( where => $where ) : () ),
92 ( defined $rotate ? ( rotate => $rotate ) : () ),
93 ( defined $offset ? ( offset => $offset ) : () ),
94 ( defined $font ? ( font => $font ) : () ),
95 ( defined $textcolor ? ( textcolor => $textcolor ) : () ),
96 } );
97 }
98  
99  
100  
101  
102  
103 ▶sub assert_coerce( $class, $args ) {
Subroutine assert_coerce: not called CC=1 SCAR=6.9
Pod documented
104 0 assert_coerce_object( $class, $args );
105 }
106  
107  
108  
109  
110  
111 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
112 0 return clone_object( $self, \%args );
113 }
114  
115  
116  
117  
118  
119  
120 method opts {
121 0 ▶ my @opts;
Subroutine opts: not called CC=7 SCAR=40.3
Pod documented
122  
123 0 ▶ defined $format
Branch: 1 branch
BranchTrueFalseTotal
defined $format and push @opts, maybe_quote($format) 0 0 0
124 and push @opts, maybe_quote( $format );
125  
126  
127 0 ▶ defined $where
Branch: 1 branch
BranchTrueFalseTotal
defined $where and push @opts, $where 0 0 0
128 and push @opts, $where;
129  
130 0 ▶ defined $offset
Branch: 1 branch
BranchTrueFalseTotal
defined $offset and push @opts, render_opts("offset", $offset) 0 0 0
131 and push @opts, render_opts( offset => $offset );
132  
133 0 ▶ defined $rotate
Branch: 3 branches
BranchTrueFalseTotal
defined $rotate and push @opts, builtin::is_bool($rotate) ? $rotate ? "rotate" : "norotate" : ["rotate by", $rotate] 0 0 0
builtin::is_bool($rotate) ? : 0 0 0
$rotate ? : 0 0 0
134 and push @opts, is_bool( $rotate )
135 ? ( $rotate ? 'rotate' : 'norotate' )
136 : [ 'rotate by' => $rotate ];
137  
138  
139 0 push @opts, render_opts( font => $font );
140  
141 0 push @opts, render_opts( textcolor => $textcolor );
142  
143 0 return @opts;
144 }
145  
146  
147  
148  
149  
150 1 signature_for set => (
151 method => 1,
152 named => [
153 as => SetFormats,
154 { default => 'string' },
155 ],
156 );
157  
158 method set ( $opt ) {
159 return render_set( [ render_opts( [ set => 'timestamp' ], $self ) ], $opt->as );
160 }
161  
162  
163 #
164 # This file is part of CXC-Gnuplot
165 #
166 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
167 #
168 # This is free software, licensed under:
169 #
170 # The GNU General Public License, Version 3, June 2007
171 #
172  
173 1 1;
174  
175 __END__
« blib/lib/CXC/Gnuplot/V1/Util.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/TermOptions.pm »