blib/lib/CXC/Gnuplot/V1/AxisRange.pm

filter: Statementstmt 75.0% 6 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 81.8% 9 / 11 CC 1 SCAR 0.9
CC
1
Cov
75%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/CXC/Gnuplot/V1/AxisMinorTics.pm ↑ Summary blib/lib/CXC/Gnuplot/V1/AxisTics.pm »
1 package CXC::Gnuplot::V1::AxisRange;
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 Object::Pad 0.821;
Subroutine BEGIN: called CC=1 SCAR=2.6
6  
7 our $VERSION = 'v0.29.3';
8  
9 class CXC::Gnuplot::V1::AxisRange : isa(CXC::Gnuplot::V1::Base)
10 does( CXC::Gnuplot::V1::Role::Clone );
11  
12 use CXC::Gnuplot::V1::Bound;
13  
14 use CXC::Gnuplot::V1::Util
15 -lexical => 'pvalidate',
16 'render_opts', 'render_set';
17  
18 use CXC::Gnuplot::V1::Types -lexical => qw( signature_for SetFormats NonEmptyStr );
19  
20 use builtin::compat 'true';
21  
22 #<<< no tidy
23 field $min :param :reader = undef;
24 field $max :param :reader = undef;
25 field $reverse :param :reader = undef;
26 field $extend :param :reader = undef;
27 field $writeback :param :reader = undef;
28 field $restore :param :reader = undef;
29 #>>>
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51 my sub croak {
52 require Carp;
53 goto \&Carp::croak;
54 }
55  
56 ADJUST {
57 pvalidate( min => Bound => \$min );
58 pvalidate( max => Bound => \$max );
59 }
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79 method to_hash {
80 return {
81 ( defined $extend ? ( extend => $extend ) : () ),
82 ( defined $max ? ( max => $max ) : () ),
83 ( defined $min ? ( min => $min ) : () ),
84 ( defined $reverse ? ( reverse => $reverse ) : () ),
85 ( defined $writeback ? ( writeback => $writeback ) : () ),
86 };
87 }
88  
89  
90  
91  
92  
93 method opts {
94  
95 return (
96 ( $self->has_limit ? sprintf( '[%s:%s]', $min // q{}, $max // q{} ) : () ),
97 ( defined $extend ? $extend ? 'extend' : 'noextend' : () ),
98 ( defined $restore && $restore ? 'restore' : () ),
99 ( defined $reverse ? $reverse ? 'reverse' : 'noreverse' : () ),
100 ( defined $writeback ? $writeback ? 'writeback' : 'nowriteback' : () ),
101 );
102  
103 }
104  
105  
106  
107  
108  
109 signature_for set => (
110 method => 1,
111 head => [NonEmptyStr],
112 named => [
113 as => SetFormats,
114 { default => 'string' },
115 ],
116 );
117  
118 method set ( $axis, $opt ) {
119  
120 return render_set( [ render_opts( [ set => $axis . 'range' ], $self ) ], $opt->as );
121 }
122  
123  
124  
125  
126  
127  
128 method has_limit {
129 return defined( $min // $max );
130 }
131  
132 1;
133  
134 #
135 # This file is part of CXC-Gnuplot
136 #
137 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
138 #
139 # This is free software, licensed under:
140 #
141 # The GNU General Public License, Version 3, June 2007
142 #
143  
144 __END__
« blib/lib/CXC/Gnuplot/V1/AxisMinorTics.pm ↑ Summary blib/lib/CXC/Gnuplot/V1/AxisTics.pm »