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