File Coverage

blib/lib/Consul/ACL.pm
Criterion Covered Total %
statement 15 18 83.3
branch 0 8 0.0
condition n/a
subroutine 5 7 71.4
pod 0 1 0.0
total 20 34 58.8


line stmt bran cond sub pod time code
1             package Consul::ACL;
2             $Consul::ACL::VERSION = '0.025';
3 9     9   70 use namespace::autoclean;
  9         20  
  9         55  
4              
5 9     9   697 use Moo;
  9         23  
  9         45  
6 9     9   3052 use Types::Standard qw(Str);
  9         28  
  9         66  
7 9     9   4468 use Carp qw(croak);
  9         19  
  9         392  
8 9     9   57 use JSON::MaybeXS;
  9         18  
  9         2328  
9              
10             has name => ( is => 'ro', isa => Str );
11             has id => ( is => 'ro', isa => Str );
12             has type => ( is => 'ro', isa => Str );
13             has rules => ( is => 'ro', isa => Str );
14              
15 0     0 0   sub to_json { shift->_json }
16             has _json => ( is => 'lazy', isa => Str );
17             sub _build__json {
18 0     0     my ($self) = @_;
19 0 0         encode_json({
    0          
    0          
    0          
20             defined $self->name ? ( Name => $self->name ) : (),
21             defined $self->id ? ( ID => $self->id ) : (),
22             defined $self->type ? ( Type => $self->type ) : (),
23             defined $self->rules ? ( Rules => $self->rules ) : (),
24             });
25             }
26              
27             1;