File Coverage

blib/lib/Data/Validate/CSV/Cell.pm
Criterion Covered Total %
statement 27 27 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod 0 1 0.0
total 38 39 97.4


line stmt bran cond sub pod time code
1 2     2   23 use v5.12;
  2         7  
2 2     2   11 use strict;
  2         3  
  2         37  
3 2     2   9 use warnings;
  2         3  
  2         112  
4              
5             package Data::Validate::CSV::Cell;
6              
7             our $AUTHORITY = 'cpan:TOBYINK';
8             our $VERSION = '0.003';
9              
10 2     2   1015 use Moo::Role;
  2         35857  
  2         9  
11 2     2   1765 use Data::Validate::CSV::Types -types;
  2         6  
  2         23  
12 2     2   12466 use Types::Common::Numeric qw( PositiveInt );
  2         25246  
  2         14  
13 2     2   1837 use namespace::autoclean;
  2         28109  
  2         21  
14              
15             requires '_chunk_for_key_string';
16              
17             has raw_value => ( is => 'ro', isa => Str );
18             has row_number => ( is => 'ro', isa => Maybe[PositiveInt] );
19             has col_number => ( is => 'ro', isa => Maybe[PositiveInt] );
20             has row => ( is => 'ro', isa => Object, weaken => !!1 );
21             has col => ( is => 'ro', isa => Object, weaken => !!1, handles => ['datatype'] );
22              
23             has _errors => (
24             is => 'lazy',
25 13     13   162 builder => sub { [] },
26             );
27              
28 33     33 0 40345 sub errors { $_[0]->value; $_[0]->_errors }
  33         655  
29              
30             has value => ( is => 'lazy' );
31             has inflated_value => ( is => 'lazy' );
32              
33             sub _build_value {
34 13     13   979 my $self = shift;
35 13         213 $self->col->canonicalize_value($self->_errors, $self->raw_value);
36             }
37              
38             sub _build_inflated_value {
39 12     12   27379 my $self = shift;
40 12         75 $self->col->inflate_value([], $self->raw_value);
41             }
42              
43             1;