File Coverage

blib/lib/Dash/BaseComponent.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 24 26 92.3


line stmt bran cond sub pod time code
1             package Dash::BaseComponent;
2              
3 9     9   73288 use Moo;
  9         11183  
  9         53  
4 9     9   4837 use strictures 2;
  9         3345  
  9         347  
5 9     9   2665 use namespace::clean;
  9         20920  
  9         56  
6              
7             sub DashNamespace {
8 2     2 0 1092 return 'no_namespace';
9             }
10              
11             sub TO_JSON {
12 4     4 0 10 my $self = shift;
13 4         16 my @components = split( /::/, ref($self) );
14 4         8 my $type = $components[-1];
15 4         18 my %hash = %$self;
16 4 100       17 if ( !exists $hash{children} ) {
17 2         5 $hash{children} = undef;
18             }
19 4         16 return { type => $type,
20             namespace => $self->DashNamespace,
21             props => \%hash
22             };
23             }
24              
25             1;
26              
27             __END__