File Coverage

blib/lib/Geo/SpatialDB/Entity.pm
Criterion Covered Total %
statement 6 14 42.8
branch 0 2 0.0
condition 0 9 0.0
subroutine 2 4 50.0
pod 0 2 0.0
total 8 31 25.8


line stmt bran cond sub pod time code
1             package Geo::SpatialDB::Entity;
2             $Geo::SpatialDB::Entity::VERSION = '0.000_001'; # TRIAL
3              
4 2     2   712 $Geo::SpatialDB::Entity::VERSION = '0.000001';use Moo 2;
  2         25  
  2         13  
5 2     2   327 use namespace::clean;
  2         2  
  2         7  
6              
7             # ABSTRACT: A logical thing found on a map (as opposed to the physical features that form it)
8              
9             has id => ( is => 'rw' );
10             has type => ( is => 'rw' );
11             has tags => ( is => 'rw' );
12              
13             sub TO_JSON {
14 0     0 0   my $self= shift;
15 0           my %data= %$self;
16 0           for (keys %data) {
17             delete $data{$_}
18             if $_ =~ /^[^a-z]/
19             or !defined $data{$_}
20 0 0 0       or (ref $data{$_} eq 'HASH' && !keys %{ $data{$_} });
  0   0        
      0        
21             }
22 0           \%data;
23             }
24              
25             sub tag {
26 0     0 0   my ($self, $key)= @_;
27 0           return $self->{tags}{$key};
28             }
29              
30             1;
31              
32             __END__