line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DateTime::Format::Human::Duration::Simple::Locale; |
2
|
1
|
|
|
1
|
|
798
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
4084
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has 'serial_comma' => ( |
6
|
|
|
|
|
|
|
isa => 'Bool', |
7
|
|
|
|
|
|
|
is => 'ro', |
8
|
|
|
|
|
|
|
default => 1, |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'units' => ( |
12
|
|
|
|
|
|
|
isa => 'HashRef[ArrayRef[Str]]', |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
lazy => 1, |
15
|
|
|
|
|
|
|
builder => '_build_units', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _build_units { |
19
|
9
|
|
|
9
|
|
13
|
my $self = shift; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return { |
22
|
9
|
|
|
|
|
522
|
and => [ 'and' ], |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
year => [ 'year', 'years' ], |
25
|
|
|
|
|
|
|
month => [ 'month', 'months' ], |
26
|
|
|
|
|
|
|
week => [ 'week', 'weeks' ], |
27
|
|
|
|
|
|
|
hour => [ 'hour', 'hours' ], |
28
|
|
|
|
|
|
|
day => [ 'day', 'days' ], |
29
|
|
|
|
|
|
|
hour => [ 'hour', 'hours' ], |
30
|
|
|
|
|
|
|
minute => [ 'minute', 'minutes' ], |
31
|
|
|
|
|
|
|
second => [ 'second', 'seconds' ], |
32
|
|
|
|
|
|
|
millisecond => [ 'millisecond', 'milliseconds' ], |
33
|
|
|
|
|
|
|
nanosecond => [ 'nanosecond', 'nanoseconds' ], |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub get_unit_for_value { |
38
|
73
|
|
|
73
|
0
|
94
|
my $self = shift; |
39
|
73
|
|
|
|
|
123
|
my $unit = shift; |
40
|
73
|
|
|
|
|
85
|
my $value = shift; |
41
|
|
|
|
|
|
|
|
42
|
73
|
100
|
|
|
|
161
|
unless ( defined $value ) { |
43
|
15
|
|
|
|
|
742
|
return $self->units->{$unit}->[0]; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
58
|
100
|
|
|
|
2793
|
return ( $value == 1 ) ? $self->units->{$unit}->[0] : $self->units->{$unit}->[1]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |