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   961 use v5.40;
  2         6  
2 2     2   9 use experimental 'class';
  2         3  
  2         35  
3              
4 1     1   814 class Minima::View::JSON :isa(Minima::View);
  1         6  
  1         70  
5              
6 2     2   868 use JSON;
  2         13089  
  2         13  
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__