Commit | Line | Data |
ddccc6a2 |
1 | package Reaction::UI::ViewPort::Field::Mutable::Array; |
2 | |
3 | use Reaction::Class; |
4 | |
5 | class Array is 'Reaction::UI::ViewPort::Field::Array', which { |
6 | does 'Reaction::UI::ViewPort::Field::Role::Mutable'; |
7 | |
8 | around value => sub { |
9 | my $orig = shift; |
10 | my $self = shift; |
11 | return $orig->($self) unless @_; |
c8fbb8ad |
12 | my $value = defined $_[0] ? $_[0] : []; |
ddccc6a2 |
13 | $orig->($self, (ref $value eq 'ARRAY' ? $value : [ $value ])); |
14 | $self->sync_to_action; |
15 | }; |
16 | }; |
17 | |
18 | 1; |
19 | |