pervasive type constraints
[scpubgit/DX.git] / lib / DX / Role / Value.pm
CommitLineData
9d759b64 1package DX::Role::Value;
2
3use DX::ActionBuilder::Null;
4use DX::Role;
5
2548ce61 6my $_null = DX::ActionBuilder::Null->new;
7
9d759b64 8has action_builder => (
9 is => 'ro',
2548ce61 10 isa => ActionBuilder,
11 default => sub { $_null },
6aa36401 12 handles => [ qw(can_set_value aperture_for_set_value action_for_set_value) ],
9d759b64 13);
14
345270ac 15sub value_path { shift->action_builder->target_path }
16
9d759b64 17sub is_set { 1 }
18
efad53c4 19sub but_set_action_builder {
20 my ($self, $ab) = @_;
21 $self->but(action_builder => $ab);
22}
23
9e13b86b 24requires 'to_data';
25
26sub equals {
27 my ($self, $other) = @_;
28 require YAML;
29 YAML::Dump($self->to_data) eq YAML::Dump($other->to_data);
30}
31
9d759b64 321;