Catmandu/Fix/join_field.pm

filter: Statementstmt 96.6% 29 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod n/a totaltotal 94.8% 37 / 39 CC 1 SCAR 0.1
CC
1
Cov
97%
__ANON__
1.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Catmandu/Fix/split_field.pm ↑ Summary Catmandu/Serializer/json.pm »
1 package Catmandu::Fix::join_field;
2  
3 1 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.2025';
6  
7 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Catmandu::Util::Path qw(as_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Catmandu::Util qw(is_value);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Catmandu::Fix::Has;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 has path => (fix_arg => 1);
14 0 ▶has join_char => (fix_arg => 1, default => sub {''});
Subroutine __ANON__: not called CC=1 SCAR=1.2
15  
16 1 with 'Catmandu::Fix::Builder';
17  
18 5 ▶sub _build_fixer {
Subroutine _build_fixer: called CC=1 SCAR=0.0
19 5 my ($self) = @_;
20 5 my $join_char = $self->join_char;
21 as_path($self->path)->updater(
22 5 ▶ if_array_ref => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
23 5 join $join_char, grep {is_value($_)} @{$_[0]};
24 }
25 5 );
26 }
27  
28 1 1;
29  
30 __END__
« Catmandu/Fix/split_field.pm ↑ Summary Catmandu/Serializer/json.pm »