Commit | Line | Data |
efad53c4 |
1 | package DX::ActionBuilder::Normal; |
2 | |
0498469a |
3 | use DX::Action::SetValue; |
4 | use DX::Action::AddValue; |
efad53c4 |
5 | use DX::Class; |
6 | |
7 | with 'DX::Role::ActionBuilder'; |
8 | |
9 | has target_path => (is => 'ro', required => 1); |
10 | |
11 | sub action_for_set_value { |
12 | my ($self, $value) = @_; |
13 | DX::Action::SetValue->new( |
14 | target_path => $self->target_path, |
15 | new_value => $value->but_set_action_builder($self) |
4016201b |
16 | ->but_set_identity_path($self->target_path) |
efad53c4 |
17 | ); |
18 | } |
19 | |
0498469a |
20 | sub action_for_add_member { |
21 | my ($self, $at, $value) = @_; |
22 | my @add_path = (@{$self->target_path}, ref($at) ? $at->string_value : $at); |
23 | DX::Action::AddValue->new( |
24 | target_path => \@add_path, |
25 | new_value => $value->but_set_action_builder( |
26 | $self->but(target_path => \@add_path) |
4016201b |
27 | )->but_set_identity_path(\@add_path) |
0498469a |
28 | ); |
29 | } |
30 | |
31 | sub action_for_remove_member { die 'WHUT' } |
32 | |
efad53c4 |
33 | 1; |