| 1 | package Salus::Row; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use Rope; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use Rope::Autoload; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use Types::Standard qw/ArrayRef/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use Salus::Row::Column; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 3 | property columns => ( | |||||||||
| 9 | initable => 1, | ||||||||||
| 10 | writeable => 0, | ||||||||||
| 11 | configurable => 1, | ||||||||||
| 12 | required => 1, | ||||||||||
| 13 | enumerable => 1, | ||||||||||
| 14 | type => ArrayRef, | ||||||||||
| 15 | value => [] | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | function as_array => sub { | ||||||||||
| 19 | 5 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 20 | return [map { | ||||||||||
| 21 | 20 | $_->value | |||||||||
| 22 | 5 | } @{$self->columns}]; | |||||||||
| 23 | 3 | }; | |||||||||
| 24 | |||||||||||
| 25 | function get_col => sub { | ||||||||||
| 26 | 12 | ▶ | my ($self, $col) = @_; | ||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=20.9
| |||||||||||
| 27 | 12 | ▶ | if ($col !~ m/^\d+$/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | for (@{$self->columns}) { | |||||||||
| 29 | 0 | ▶ | if ($_->header->name =~ m/^($col)$/) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 0 | $col = $_->header->index; | |||||||||
| 31 | } | ||||||||||
| 32 | } | ||||||||||
| 33 | } | ||||||||||
| 34 | 12 | return $self->columns->[$col]; | |||||||||
| 35 | 3 | }; | |||||||||
| 36 | |||||||||||
| 37 | function set_col => sub { | ||||||||||
| 38 | 2 | ▶ | my ($self, $col, $value) = @_; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 39 | 2 | $self->get_col($col)->value = $value; | |||||||||
| 40 | 3 | }; | |||||||||
| 41 | |||||||||||
| 42 | function delete_col => sub { | ||||||||||
| 43 | 0 | ▶ | my ($self, $col) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 44 | 0 | $self->get_col($col)->value = ''; | |||||||||
| 45 | 3 | }; | |||||||||
| 46 | |||||||||||
| 47 | 3 | 1; | |||||||||