rename is_dict to dict, add proto argument
[scpubgit/DX.git] / lib / DX / ActionBuilder / Normal.pm
CommitLineData
efad53c4 1package DX::ActionBuilder::Normal;
2
0498469a 3use DX::Action::SetValue;
4use DX::Action::AddValue;
efad53c4 5use DX::Class;
6
7with 'DX::Role::ActionBuilder';
8
9has target_path => (is => 'ro', required => 1);
10
11sub 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 20sub 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
31sub action_for_remove_member { die 'WHUT' }
32
efad53c4 331;