File Coverage

blib/lib/Statistics/R/REXP/Character.pm
Criterion Covered Total %
statement 25 25 100.0
branch 3 4 75.0
condition 1 3 33.3
subroutine 8 8 100.0
pod 0 2 0.0
total 37 42 88.1


line stmt bran cond sub pod time code
1             package Statistics::R::REXP::Character;
2             # ABSTRACT: an R character vector
3             $Statistics::R::REXP::Character::VERSION = '1.0002';
4 19     19   48730 use 5.010;
  19         64  
5              
6 19     19   361 use Class::Tiny::Antlers;
  19         3015  
  19         115  
7 19     19   2634 use namespace::clean;
  19         8736  
  19         90  
8              
9             extends 'Statistics::R::REXP::Vector';
10 19     19   15658 use overload;
  19         11152  
  19         112  
11              
12              
13 19     19   903 use constant sexptype => 'STRSXP';
  19         41  
  19         3677  
14              
15 534     534   2237 sub _type { 'character'; }
16              
17              
18             sub BUILDARGS {
19 3432     3432 0 168350 my $class = shift;
20 3432         12718 my $attributes = $class->SUPER::BUILDARGS(@_);
21              
22 3431 100       11389 if (ref($attributes->{elements}) eq 'ARRAY') {
23             $attributes->{elements} = [
24 3411         5416 Statistics::R::REXP::Vector::_flatten(@{$attributes->{elements}})
  3411         10614  
25             ]
26             }
27             $attributes
28 3431         8250 }
29              
30              
31             sub BUILD {
32 3428     3428 0 90443 my ($self, $args) = @_;
33              
34             # Required attribute type
35             die "Elements of the 'elements' attribute must be scalar values" if defined($self->elements) &&
36 3428 50 33     51328 grep { ref($_) } @{$self->elements}
  9680         36956  
  3428         64349  
37             }
38              
39              
40             1; # End of Statistics::R::REXP::Character
41              
42             __END__