line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Translate::Fluent::Elements::Term; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
40
|
use Moo; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
34
|
|
4
|
|
|
|
|
|
|
extends 'Translate::Fluent::Elements::Base'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has [qw(identifier pattern attributes)] => ( |
7
|
|
|
|
|
|
|
is => 'ro', |
8
|
|
|
|
|
|
|
default => sub { undef }, |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
around BUILDARGS => sub { |
12
|
|
|
|
|
|
|
my ($orig, $class, %args) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$args{ identifier } = delete $args{ Identifier }; |
15
|
|
|
|
|
|
|
$args{ pattern } = delete $args{ Pattern }; |
16
|
|
|
|
|
|
|
$args{ attributes} = delete $args{ Attribute }; |
17
|
|
|
|
|
|
|
$args{ attributes } = [ $args{ attributes } ] |
18
|
|
|
|
|
|
|
unless ref $args{ attributes } eq 'ARRAY'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$args{ attributes } = [ map { { Attribute => $_ } } |
21
|
|
|
|
|
|
|
@{ $args{ attributes } } |
22
|
|
|
|
|
|
|
]; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$class->$orig( %args ); |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub translate { |
28
|
6
|
|
|
6
|
1
|
14
|
my ($self, $variables) = @_; |
29
|
|
|
|
|
|
|
|
30
|
6
|
|
|
|
|
28
|
return $self->pattern->translate( $variables ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub get_attribute_resource { |
34
|
9
|
|
|
9
|
1
|
21
|
my ($self, $attr_id) = @_; |
35
|
|
|
|
|
|
|
|
36
|
9
|
|
|
|
|
12
|
for my $attr ( @{ $self->attributes } ) { |
|
9
|
|
|
|
|
23
|
|
37
|
15
|
100
|
|
|
|
46
|
return $attr |
38
|
|
|
|
|
|
|
if $attr->identifier eq $attr_id; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |