File Coverage

blib/lib/Minima/View/JSON.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1 2     2   1184 use v5.40;
  2         10  
2 2     2   16 use experimental 'class';
  2         5  
  2         16  
3              
4 1     1   802 class Minima::View::JSON :isa(Minima::View);
  1         5  
  1         47  
5              
6 2     2   1061 use JSON;
  2         13651  
  2         20  
7              
8             field $app :param;
9              
10             method prepare_response ($response)
11             {
12             $response->content_type('application/json');
13             }
14              
15             method render ($data = {})
16             {
17             $app->development
18             ? JSON->new->utf8->pretty->encode($data)
19             : encode_json $data
20             ;
21             }
22              
23             __END__