c8f43d163e7017287fe55fe080dff1818e69ac33
[scpubgit/DX.git] / lib / DX / Action / BindValue.pm
1 package DX::Action::BindValue;
2
3 use DX::Update::SetValue;
4 use DX::ActionBuilder::BoundValue;
5 use DX::Class;
6
7 with 'DX::Role::SimpleAction';
8
9 has new_value => (is => 'ro', required => 1);
10
11 sub for_deparse {
12   my ($self) = @_;
13   [ statement => [
14     [ symbol => 'BindValue' ],
15     [ value_path => $self->target_path ],
16     [ value_path => $self->new_value
17                          ->action_builder
18                          ->inner_action_builder
19                          ->target_path ],
20   ] ];
21 }
22
23 sub _build__updates {
24   my ($self) = @_;
25   DX::Update::SetValue->new(
26     target_path => $self->target_path,
27     new_value => $self->new_value,
28   );
29 }
30
31 1;
32