File Coverage

blib/lib/FalkorDB/Node.pm
Criterion Covered Total %
statement 6 22 27.2
branch 0 6 0.0
condition 0 4 0.0
subroutine 2 8 25.0
pod 4 6 66.6
total 12 46 26.0


line stmt bran cond sub pod time code
1             package FalkorDB::Node;
2              
3 6     6   29 use strict;
  6         7  
  6         165  
4 6     6   27 use warnings;
  6         7  
  6         1487  
5              
6             sub new {
7 0     0 0   my ( $class, %args ) = @_;
8 0           return bless \%args, $class;
9             }
10              
11 0     0 1   sub id { shift->{id} }
12 0     0 1   sub labels { shift->{labels} }
13 0     0 1   sub properties { shift->{properties} }
14              
15             sub property {
16 0     0 1   my ( $self, $key ) = @_;
17 0           return $self->{properties}->{$key};
18             }
19              
20             sub new_from_resp {
21 0     0 0   my ( $class, $resp ) = @_;
22 0           my ( $id, $labels, $properties );
23              
24 0           for my $pair (@$resp) {
25 0           my ( $k, $v ) = @$pair;
26 0 0         if ( $k eq 'id' ) {
    0          
    0          
27 0           $id = $v;
28             }
29             elsif ( $k eq 'labels' ) {
30 0           $labels = $v;
31             }
32             elsif ( $k eq 'properties' ) {
33 0           $properties = FalkorDB::QueryResult::_parse_properties($v);
34             }
35             }
36              
37 0   0       return $class->new(
      0        
38             id => $id,
39             labels => $labels || [],
40             properties => $properties || {},
41             );
42             }
43              
44             1;
45             __END__