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.0001';
4 19     19   23334 use 5.010;
  19         45  
5              
6 19     19   494 use Class::Tiny::Antlers;
  19         3904  
  19         93  
7 19     19   1976 use namespace::clean;
  19         9426  
  19         80  
8              
9             extends 'Statistics::R::REXP::Vector';
10 19     19   14867 use overload;
  19         10183  
  19         88  
11              
12              
13 19     19   719 use constant sexptype => 'STRSXP';
  19         21  
  19         3140  
14              
15 531     531   1878 sub _type { 'character'; }
16              
17              
18             sub BUILDARGS {
19 3432     3432 0 174937 my $class = shift;
20 3432         8662 my $attributes = $class->SUPER::BUILDARGS(@_);
21              
22 3431 100       7342 if (ref($attributes->{elements}) eq 'ARRAY') {
23             $attributes->{elements} = [
24 3411         2903 Statistics::R::REXP::Vector::_flatten(@{$attributes->{elements}})
  3411         7861  
25             ]
26             }
27             $attributes
28 3431         5674 }
29              
30              
31             sub BUILD {
32 3428     3428 0 76137 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     46040 grep { ref($_) } @{$self->elements}
  9680         25250  
  3428         55222  
37             }
38              
39              
40             1; # End of Statistics::R::REXP::Character
41              
42             __END__