File Coverage

blib/lib/Whelk/Schema/Definition/String.pm
Criterion Covered Total %
statement 13 13 100.0
branch 4 4 100.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1             package Whelk::Schema::Definition::String;
2             $Whelk::Schema::Definition::String::VERSION = '1.04';
3 24     24   17201 use Whelk::StrictBase 'Whelk::Schema::Definition::_Scalar';
  24         55  
  24         182  
4              
5             sub openapi_dump
6             {
7 10     10 1 21 my ($self, $openapi_obj, %hints) = @_;
8              
9 10         89 my $res = $self->SUPER::openapi_dump($openapi_obj, %hints);
10 10         33 $res->{type} = 'string';
11              
12 10         48 return $res;
13             }
14              
15             sub _inhale
16             {
17 84     84   209 my ($self, $value) = @_;
18              
19 84         339 my $inhaled = $self->SUPER::_inhale($value);
20 84 100       258 return $inhaled if defined $inhaled;
21 80 100       259 return 'string' if ref $value;
22 76         314 return $self->_inhale_extra_rules($value);
23             }
24              
25             sub _exhale
26             {
27 61     61   391 return '' . pop();
28             }
29              
30             1;
31