File Coverage

blib/lib/WebService/Hexonet/Connector/Column.pm
Criterion Covered Total %
statement 29 29 100.0
branch 2 2 100.0
condition n/a
subroutine 9 9 100.0
pod 5 5 100.0
total 45 45 100.0


line stmt bran cond sub pod time code
1             package WebService::Hexonet::Connector::Column;
2              
3 1     1   17 use 5.026_000;
  1         3  
4 1     1   5 use strict;
  1         3  
  1         46  
5 1     1   7 use warnings;
  1         2  
  1         31  
6              
7 1     1   5 use version 0.9917; our $VERSION = version->declare('v2.9.2');
  1         14  
  1         6  
8              
9              
10             sub new {
11 155     155 1 2839 my ( $class, $key, @data ) = @_;
12 155         278 my $self = {};
13 155         343 $self->{key} = $key;
14 155         288 @{ $self->{data} } = @data;
  155         744  
15 155         374 $self->{length} = scalar @data;
16 155         535 return bless $self, $class;
17             }
18              
19              
20             sub getKey {
21 1     1 1 627 my $self = shift;
22 1         11 return $self->{key};
23             }
24              
25              
26             sub getData {
27 3     3 1 9 my $self = shift;
28 3         10 return $self->{data};
29             }
30              
31              
32             sub getDataByIndex {
33 19494     19494 1 29781 my $self = shift;
34 19494         28149 my $idx = shift;
35 19494 100       35027 return $self->{data}[ $idx ]
36             if $self->hasDataIndex($idx);
37 16041         33832 return;
38             }
39              
40              
41             sub hasDataIndex {
42 19494     19494 1 28410 my $self = shift;
43 19494         28234 my $idx = shift;
44 19494         52432 return $idx < $self->{length};
45             }
46              
47             1;
48              
49             __END__