3bd0041130229c5a1f7c4b7c9f2a53c5ecb131c9
[scpubgit/DX.git] / lib / DX / Update / RemoveValue.pm
1 package DX::Update::RemoveValue;
2
3 use DX::Utils qw(VALUE_EXISTS);
4 use DX::Class;
5
6 with 'DX::Role::Update';
7
8 sub apply_to {
9   my ($self, $scope) = @_;
10   my @path = my @whole_path = @{$self->target_path};
11   my $target = pop @path;
12   return (
13     $self->_with_value_at_path(
14       $scope, sub { $_[0]->without_member_at($target) }, @path
15     ),
16     [ VALUE_EXISTS ,=> @whole_path ],
17   );
18 }
19
20 1;