blib/lib/Catmandu/Fix/flatten.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 95.8% 23 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Catmandu/Fix/downcase.pm ↑ Summary blib/lib/Catmandu/Fix/hash.pm »
1 package Catmandu::Fix::flatten;
2  
3 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.0201_02';
6  
7 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 has path => (fix_arg => 1);
12  
13 1 with 'Catmandu::Fix::SimpleGetValue';
14  
15 sub emit_value {
16 1 ▶ my ($self, $var) = @_;
Subroutine emit_value: called CC=1 SCAR=0.0
Pod undocumented
17 1 "if (is_array_ref(${var})) {"
18 . "${var} = [map { ref \$_ eq 'ARRAY' ? \@\$_ : \$_ } \@{${var}}] "
19 . "while grep ref \$_ eq 'ARRAY', \@{${var}};" . "}";
20 }
21  
22 1 1;
23  
24 __END__
25  
26 =pod
27  
28 =head1 NAME
29  
30 Catmandu::Fix::flatten - flatten a nested array field
31  
32 =head1 SYNOPSIS
33  
34 # {deep => [1, [2, 3], 4, [5, [6, 7]]]}
35 flatten(deep)
36 # {deep => [1, 2, 3, 4, 5, 6, 7]}
37  
38 =head1 SEE ALSO
39  
40 L<Catmandu::Fix>
41  
42 =cut
« blib/lib/Catmandu/Fix/downcase.pm ↑ Summary blib/lib/Catmandu/Fix/hash.pm »