pervasive type constraints
[scpubgit/DX.git] / lib / DX / Update / SetValue.pm
1 package DX::Update::SetValue;
2
3 use DX::Utils qw(VALUE_SET);
4 use DX::Class;
5
6 with 'DX::Role::Update';
7
8 has new_value => (is => 'ro', required => 1, isa => Value);
9
10 sub apply_to {
11   my ($self, $scope) = @_;
12   my @path = @{$self->target_path};
13   my $new_value = $self->new_value;
14   return (
15     $self->_with_value_at_path($scope, sub { $new_value }, @path),
16     [ VALUE_SET ,=> @path ],
17   );
18 }
19
20 1;