| 1 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | package Search::GIN::Keys::Expand; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 4 | our $VERSION = '0.11'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 23 | ▶ | sub expand_keys { | ||||||||||||||||||||||||||
|
Subroutine
expand_keys: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | 23 | my ( $self, @keys ) = @_; | |||||||||||||||||||||||||||
| 13 | 23 | return map { $self->expand_key($_) } @keys; | |||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 82 | ▶ | sub expand_key { | ||||||||||||||||||||||||||
|
Subroutine
expand_key: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 17 | 82 | my ( $self, $value, %args ) = @_; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 82 | ▶ | return $self->expand_key_string($value) if not ref $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 39 | my $method = "expand_keys_" . lc ref($value); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 39 | ▶ | croak("Don't know how to expand $value in key") if $method =~ /::/ or not $self->can($method); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$method =~ /::/ or not $self->can($method)
MC/DC0%0/2
$method =~ /::/ or not $self->can($method)
$method =~ /::/
not $self->can($method)
Truth table33%1/3
A or not(B)
A= $method =~ /::/B= not $self->can($method)
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 39 | return $self->$method($value); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 33 | ▶ | sub expand_key_prepend { | ||||||||||||||||||||||||||
|
Subroutine
expand_key_prepend: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 33 | my ( $self, $prefix, @keys ) = @_; | |||||||||||||||||||||||||||
| 30 | 33 | return map { [ $prefix, @$_ ] } @keys; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 43 | ▶ | sub expand_key_string { | ||||||||||||||||||||||||||
|
Subroutine
expand_key_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 43 | my ( $self, $str ) = @_; | |||||||||||||||||||||||||||
| 35 | 43 | return [ $str ]; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 18 | ▶ | sub expand_keys_array { | ||||||||||||||||||||||||||
|
Subroutine
expand_keys_array: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | 18 | my ( $self, $array ) = @_; | |||||||||||||||||||||||||||
| 40 | 18 | return map { $self->expand_key($_) } @$array; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 21 | ▶ | sub expand_keys_hash { | ||||||||||||||||||||||||||
|
Subroutine
expand_keys_hash: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | 21 | my ( $self, $hash ) = @_; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | return map { | ||||||||||||||||||||||||||||
| 47 | 21 | $self->expand_key_prepend( | |||||||||||||||||||||||||||
| 48 | $_, | ||||||||||||||||||||||||||||
| 49 | 33 | $self->expand_key($hash->{$_}) | |||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||
| 51 | } keys %$hash; | ||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 4 | 1; | |||||||||||||||||||||||||||