Commit | Line | Data |
9d759b64 |
1 | package DX::Role::Value; |
2 | |
3 | use DX::ActionBuilder::Null; |
4 | use DX::Role; |
5 | |
efad53c4 |
6 | has identity_path => (is => 'ro'); |
7 | |
9d759b64 |
8 | has action_builder => ( |
9 | is => 'ro', |
10 | default => 'DX::ActionBuilder::Null', |
11 | handles => [ qw(can_set_value action_for_set_value) ], |
12 | ); |
13 | |
345270ac |
14 | sub value_path { shift->action_builder->target_path } |
15 | |
9d759b64 |
16 | sub is_set { 1 } |
17 | |
efad53c4 |
18 | sub but_set_action_builder { |
19 | my ($self, $ab) = @_; |
20 | $self->but(action_builder => $ab); |
21 | } |
22 | |
0498469a |
23 | sub but_set_identity_path { |
24 | my ($self, $path) = @_; |
25 | $self->but(identity_path => $path); |
26 | } |
27 | |
9e13b86b |
28 | requires 'to_data'; |
29 | |
30 | sub equals { |
31 | my ($self, $other) = @_; |
32 | require YAML; |
33 | YAML::Dump($self->to_data) eq YAML::Dump($other->to_data); |
34 | } |
35 | |
9d759b64 |
36 | 1; |