use DX::Action::SetValue;
use DX::ActionBuilder::Normal;
+use DX::Action::BindValue;
+use DX::ActionBuilder::BoundValue;
+use DX::Utils qw(VALUE_SET);
use DX::Class;
with 'DX::Role::ActionBuilder';
has target_path => (is => 'ro', required => 1);
+sub aperture_for_set_value {
+ [ [ VALUE_SET ,=> @{$_[0]->target_path} ] ]
+}
+
sub action_for_set_value {
my ($self, $value) = @_;
- if (0) { # value_path / identity_path test
- # bind value
+ if (my $p = $value->value_path) {
+ my $ab = DX::ActionBuilder::BoundValue->new(
+ target_path => $self->target_path,
+ rebind_path => $self->target_path,
+ bound_to_path => $p,
+ inner_action_builder => $value->action_builder,
+ );
+ return DX::Action::BindValue->new(
+ target_path => $self->target_path,
+ new_value => $ab->apply_to_value($value, $value),
+ )
}
- my $ab = DX::ActionBuilder::Normal->new(
- target_path => $self->target_path,
- );
- DX::Action::SetValue->new(
+ DX::ActionBuilder::Normal->new(
target_path => $self->target_path,
- new_value => $value->but_set_action_builder($ab),
- );
+ )->action_for_set_value($value);
}
1;