File Coverage

blib/lib/KiokuDB/TypeMap/Entry/JSON/Scalar.pm
Criterion Covered Total %
statement 23 26 88.4
branch n/a
condition n/a
subroutine 8 9 88.8
pod 0 3 0.0
total 31 38 81.5


line stmt bran cond sub pod time code
1             package KiokuDB::TypeMap::Entry::JSON::Scalar;
2 6     6   4822 use Moose;
  6         12  
  6         44  
3              
4 6     6   34535 no warnings 'recursion';
  6         13  
  6         254  
5              
6 6     6   27 use namespace::clean -except => 'meta';
  6         7  
  6         54  
7              
8             with qw(KiokuDB::TypeMap::Entry::Std);
9              
10             sub compile_collapse_body {
11 11     11 0 21 my ( $self, $class ) = @_;
12              
13             return sub {
14 14     14   51 my ( $collapser, %args ) = @_;
15              
16 14         26 my $scalar = $args{object};
17            
18 14         55 my $data = $collapser->visit($$scalar);
19              
20 14         365 $collapser->make_entry(
21             %args,
22             class => "SCALAR",
23             data => $data,
24             );
25 11         87 };
26             }
27              
28             sub compile_expand {
29 11     11 0 22 my ( $self, $reftype ) = @_;
30              
31             sub {
32 14     14   28 my ( $linker, $entry ) = @_;
33              
34 14         18 my $scalar;
35              
36 14         324 $linker->inflate_data($entry->data, \$scalar);
37              
38 14         39 return \$scalar;
39             }
40 11         84 }
41              
42             sub compile_refresh {
43 11     11 0 23 my ( $self, $class, @args ) = @_;
44              
45             return sub {
46 0     0     my ( $linker, $scalar, $entry ) = @_;
47              
48 0           $linker->inflate_data($entry->data, $scalar );
49              
50 0           return $scalar;
51 11         74 };
52             }
53              
54             __PACKAGE__->meta->make_immutable;
55              
56             __PACKAGE__
57              
58             __END__