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   12 use YAOO;
  2         4  
  2         10  
4 2     2   1681 use JSON;
  2         14533  
  2         12  
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 15 my ($self, $data) = @_;
14 2         5 return $self->json->decode($data);
15             }
16              
17             sub stringify {
18 8     8 0 61 my ($self, $data) = @_;
19 8         31 return $self->json->encode($data);
20             }
21              
22             1;