YR/Model/Temperature.pm

filter: Statementstmt 66.6% 10 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 100% 2 / 2 totaltotal 66.6% 14 / 21 CC 1 SCAR 4.1
CC
1
Cov
67%
fahrenheit
2.0
kelvin
2.0
BEGIN
1.0
CRAP 1.5
« YR/TextForecast.pm ↑ Summary YR/Model/WindSpeed.pm »
1 package Weather::YR::Model::Temperature;
2 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 extends 'Weather::YR::Model';
6  
7 =head1 NAME
8  
9 Weather::YR::Model::Temperature
10  
11 =head1 DESCRIPTION
12  
13 This class represents a data point's "temperature".
14  
15 =head1 METHODS
16  
17 This class inherits all the methods from L<Weather::YR::Model> and provides the
18 following new methods:
19  
20 =head2 celsius
21  
22 Returns the current data point's temperature in celsius.
23  
24 =cut
25  
26 3 has 'celsius' => (
27 isa => 'Num',
28 is => 'ro',
29 required => 1,
30 );
31  
32 =head2 fahrenheit
33  
34 Returns the current data point's temperature in fahrenheit.
35  
36 =cut
37  
38 0 ▶sub fahrenheit {
Subroutine fahrenheit: not called CC=1 SCAR=6.9
Pod documented
39 0 my $self = shift;
40  
41 0 my $fahrenheit = ( ($self->celsius * 9) / 5 ) + 32;
42  
43 0 return sprintf( '%.2f', $fahrenheit );
44 }
45  
46 =head2 kelvin
47  
48 Returns the current data point's temperature in kelvin.
49  
50 =cut
51  
52 0 ▶sub kelvin {
Subroutine kelvin: not called CC=1 SCAR=6.9
Pod documented
53 0 my $self = shift;
54  
55 0 return sprintf( '%.2f', $self->celsius + 273.15 );
56 }
57  
58 #
59 # The End
60 #
61 3 __PACKAGE__->meta->make_immutable;
62  
63 3 1;
« YR/TextForecast.pm ↑ Summary YR/Model/WindSpeed.pm »