File: | lib/Railsish/View/Helpers/TextHelper.pm |
Coverage: | 96.2% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Railsish::View::Helpers::TextHelper; | ||||||
2 | 1 1 1 | 8 3 12 | use strict; | ||||
3 | 1 1 1 | 10 3 7 | use warnings; | ||||
4 | |||||||
5 | 1 1 1 | 3 4 11 | use Exporter::Lite; | ||||
6 | our @EXPORT = qw(pluralize); | ||||||
7 | |||||||
8 | |||||||
9 | |||||||
10 | 1 1 1 | 76 6 22 | use Lingua::EN::Inflect qw(PL); | ||||
11 | |||||||
12 | sub pluralize { | ||||||
13 | 3 | 0 | 23 | my ($count, $singular, $plural) = @_; | |||
14 | |||||||
15 | 3 | 210 | return $singular if $count == 1; | ||||
16 | 2 | 17 | return $plural if defined $plural; | ||||
17 | 1 | 8 | return PL($singular) | ||||
18 | } | ||||||
19 | |||||||
20 | 1; |