File Coverage

blib/lib/Groonga/ResultSet.pm
Criterion Covered Total %
statement 9 18 50.0
branch 0 2 0.0
condition n/a
subroutine 3 6 50.0
pod 0 3 0.0
total 12 29 41.3


line stmt bran cond sub pod time code
1             # Copyright (C) 2021-2022 Horimoto Yasuhiro
2             #
3             # This program is free software: you can redistribute it and/or modify
4             # it under the terms of the GNU General Public License as published by
5             # the Free Software Foundation, either version 3 of the License, or
6             # (at your option) any later version.
7             #
8             # This program is distributed in the hope that it will be useful,
9             # but WITHOUT ANY WARRANTY; without even the implied warranty of
10             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11             # GNU General Public License for more details.
12             #
13             # You should have received a copy of the GNU General Public License
14             # along with this program. If not, see .
15              
16             package Groonga::ResultSet;
17              
18 1     1   548 use JSON::PP;
  1         11553  
  1         54  
19              
20 1     1   7 use strict;
  1         1  
  1         16  
21 1     1   4 use warnings;
  1         2  
  1         122  
22              
23             my $command_response_code = undef;
24             my @command_response_raw = ();
25             my $command_response = {};
26              
27             sub new {
28 0     0 0   my ($class, %args) = @_;
29 0           my $self = {%args};
30              
31 0 0         if ($self->{decoded_content}) {
32 0           @command_response_raw = decode_json($self->{decoded_content});
33 0           $command_response_code = $command_response_raw[0][0][0];
34 0           $command_response = $command_response_raw[0][1];
35             }
36              
37 0           return bless $self, $class;
38             }
39              
40             sub is_success {
41 0     0 0   return $command_response_code == 0;
42             }
43              
44             sub content {
45 0     0 0   return $command_response;
46             }
47              
48             1;