File Coverage

blib/lib/Dancer2/Session/DBIC/Role/Serializer.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Dancer2::Session::DBIC::Role::Serializer;
2              
3             =head1 NAME
4              
5             Dancer2::Session::DBIC::Role::Serializer - role consumed by all serializers
6              
7             =cut
8              
9 4     4   19927 use Dancer2::Core::Types;
  4         259678  
  4         41  
10 4     4   18066 use Moo::Role;
  4         6  
  4         32  
11             requires 'serialize', 'deserialize', '_build_serializer', '_build_deserializer';
12              
13             =head2 METHODS REQUIRED
14              
15             The following methods must be provided by any class which consumes this role:
16              
17             =over
18              
19             =item * serialize
20              
21             =item * deserialize
22              
23             =item * _build_serializer
24              
25             =item * _build_deserializer
26              
27             =back
28              
29             =head1 ATTRIBUTES
30              
31             =head2 serialize_options
32              
33             Options to be passed to the constructor of the underlying serializer class
34             as a hash reference.
35              
36             Defaults to an empty hash reference.
37              
38             =cut
39              
40             has serialize_options => (
41             is => 'ro',
42             isa => HashRef,
43             default => sub { {} },
44             );
45              
46             =head2 deserialize_options
47              
48             Options to be passed to the constructor of the underlying deserializer class
49             as a hash reference.
50              
51             Defaults to an empty hash reference.
52              
53             =cut
54              
55             has deserialize_options => (
56             is => 'ro',
57             isa => HashRef,
58             default => sub { {} },
59             );
60              
61             =head2 serializer
62              
63             Vivified serializer.
64              
65             =cut
66              
67             has serializer => (
68             is => 'lazy',
69             isa => Object,
70             );
71              
72             =head2 deserializer
73              
74             Vivified deserializer.
75              
76             =cut
77              
78             has deserializer => (
79             is => 'lazy',
80             isa => Object,
81             );
82              
83             1;