Serialize/Serializer/JSON/MaybeXS.pm

filter: Statementstmt 100% 19 / 19 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 50.0% 1 / 2 totaltotal 96.4% 27 / 28 SCAR 11.0
CC
3
Cov
100%
groom_options
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Serialize/Serializer.pm ↑ Summary Serialize/Serializer/TOML.pm »
1 package File::Serialize::Serializer::JSON::MaybeXS;
2 8 our $AUTHORITY = 'cpan:YANICK';
3 #ABSTRACT: JSON::MaybeXS serializer for File::Serialize
4 8 $File::Serialize::Serializer::JSON::MaybeXS::VERSION = '1.5.0';
5 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 8 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 8 with 'File::Serialize::Serializer';
10  
11 56 ▶sub extensions { qw/ json js / };
Subroutine extensions: called CC=1 SCAR=0.0
Pod documented
12  
13 sub serialize {
14 my( $self, $data, $options ) = @_;
15 JSON::MaybeXS->new(%$options)->encode( $data);
16 }
17  
18 sub deserialize {
19 my( $self, $data, $options ) = @_;
20 JSON::MaybeXS->new(%$options)->decode( $data);
21 }
22  
23 sub groom_options {
24 37 ▶ my( $self, $options ) = @_;
Subroutine groom_options: called CC=3 SCAR=11.0
Pod undocumented
25  
26 37 my %groomed;
27 37 for my $k( qw/ pretty canonical allow_nonref / ) {
28 111 ▶ $groomed{$k} = $options->{$k} if defined $options->{$k};
Branch: 1 branch
BranchTrueFalseTotal
if defined $options->{$k} 90 21 111
29 }
30  
31 37 return \%groomed;
32 }
33  
34 8 1;
35  
36 __END__
« Serialize/Serializer.pm ↑ Summary Serialize/Serializer/TOML.pm »