blib/lib/Data/Localize/Format/NamedArgs.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 8 | 8 | 100.0 |
branch | 3 | 4 | 75.0 |
condition | n/a | ||
subroutine | 2 | 2 | 100.0 |
pod | 1 | 1 | 100.0 |
total | 14 | 15 | 93.3 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Data::Localize::Format::NamedArgs; | ||||||
2 | 1 | 1 | 470 | use Moo; | |||
1 | 1 | ||||||
1 | 6 | ||||||
3 | |||||||
4 | extends 'Data::Localize::Format'; | ||||||
5 | |||||||
6 | sub format { | ||||||
7 | 10 | 10 | 1 | 210 | my ($self, $lang, $value, $args) = @_; | ||
8 | |||||||
9 | 10 | 100 | 30 | return $value unless ref $args eq 'HASH'; | |||
10 | |||||||
11 | 8 | 50 | 38 | $value =~ s/\{\{([^}]+)\}\}/ $args->{ $1 } || '' /ex; | |||
8 | 32 | ||||||
12 | 8 | 31 | return $value; | ||||
13 | } | ||||||
14 | |||||||
15 | 1; | ||||||
16 | |||||||
17 | __END__ |