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