File Coverage

blib/lib/Weather/YR/Model/WindSpeed.pm
Criterion Covered Total %
statement 6 8 75.0
branch n/a
condition n/a
subroutine 2 3 66.6
pod n/a
total 8 11 72.7


line stmt bran cond sub pod time code
1             package Weather::YR::Model::WindSpeed;
2 3     3   20 use Moose;
  3         4  
  3         25  
3 3     3   12395 use namespace::autoclean;
  3         7  
  3         31  
4              
5             extends 'Weather::YR::Model';
6              
7             =encoding utf-8
8              
9             =head1 NAME
10              
11             Weather::YR::Model::WindSpeed
12              
13             =head1 DESCRIPTION
14              
15             This class represents a data point's wind speed.
16              
17             =head1 METHODS
18              
19             This class inherits all the methods from L<Weather::YR::Model> and provides the
20             following new methods:
21              
22             =head2 mps
23              
24             Returns the current data point's wind speed in meters pr. second.
25              
26             =cut
27              
28             has 'mps' => (
29             isa => 'Num',
30             is => 'ro',
31             required => 1,
32             );
33              
34             =head2 fps
35              
36             Returns the current data point's wind speed in feet pr. second.
37              
38             =cut
39              
40             has 'fps' => (
41             isa => 'Num',
42             is => 'ro',
43             lazy_build => 1,
44             );
45              
46             sub _build_fps {
47 0     0     my $self = shift;
48              
49 0           return sprintf( '%.1f', $self->mps * 3.28083989501312 );
50             }
51              
52             =head2 beaufort
53              
54             Returns the current data point's wind speed on the beaufort scale.
55              
56             =cut
57              
58             has 'beaufort' => (
59             isa => 'Num',
60             is => 'ro',
61             required => 1,
62             );
63              
64             =head2 name
65              
66             Returns the current data point's wind speed described with a string.
67              
68             Only Norwegian (bokmÃ¥l) is supported at the moment.
69              
70             =cut
71              
72             has 'name' => (
73             isa => 'Str',
74             is => 'ro',
75             required => 1,
76             );
77              
78             #
79             # The End
80             #
81             __PACKAGE__->meta->make_immutable;
82              
83             1;