File Coverage

blib/lib/ODS/Serialize/JSON.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 14 16 87.5


line stmt bran cond sub pod time code
1             package ODS::Serialize::JSON;
2              
3 2     2   10 use YAOO;
  2         4  
  2         9  
4 2     2   1678 use JSON;
  2         14561  
  2         11  
5              
6             has pretty => isa(boolean(1)), lazy;
7              
8             has file_suffix => isa(string('json'));
9              
10             has json => isa(object(1)), coerce => sub { JSON->new->pretty($_[0]->pretty); };
11              
12             sub parse {
13 2     2 0 25 my ($self, $data) = @_;
14 2         8 return $self->json->decode($data);
15             }
16              
17             sub stringify {
18 8     8 0 87 my ($self, $data) = @_;
19 8         44 return $self->json->encode($data);
20             }
21              
22             1;