File Coverage

blib/lib/JSON/TypeInference/Type/Array.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 5 0.0
total 23 28 82.1


line stmt bran cond sub pod time code
1             package JSON::TypeInference::Type::Array;
2 3     3   29064 use strict;
  3         6  
  3         85  
3 3     3   14 use warnings;
  3         6  
  3         582  
4              
5             sub new {
6 3     3 0 49   my ($class, $element_type) = @_;
7 3         16   return bless { element_type => $element_type }, $class;
8             }
9              
10             sub name {
11 1     1 0 3   my ($class) = @_;
12 1         3   return 'array';
13             }
14              
15             # => Type
16             sub element_type {
17 3     3 0 5044   my ($self) = @_;
18 3         20   return $self->{element_type};
19             }
20              
21             sub signature {
22 1     1 0 4   my ($self) = @_;
23 1         4   return sprintf 'array[%s]', $self->element_type->signature;
24             }
25              
26             sub accepts {
27 45     45 0 1220   my ($class, $data) = @_;
28 45         160   return ref($data) eq 'ARRAY';
29             }
30              
31             1;
32             __END__
33            
34             =encoding utf-8
35            
36             =head1 NAME
37            
38             JSON::TypeInference::Type::Array - JSON array type
39            
40             =head1 DESCRIPTION
41            
42             JSON::TypeInference::Type::Array represents JSON array type.
43            
44             It is a container type, and has a type parameter that called C<< element_type >>.
45            
46             =head1 AUTHOR
47            
48             aereal E<lt>aereal@aereal.orgE<gt>
49            
50             =cut
51            
52