Commit | Line | Data |
9fd6087b |
1 | package DX::Predicate::Dict; |
efad53c4 |
2 | |
feceff29 |
3 | use DX::Utils qw(rspace res dict TYPE_OF); |
efad53c4 |
4 | use DX::Class; |
5 | |
6 | with 'DX::Role::Predicate'; |
7 | |
feceff29 |
8 | sub _resolution_space_for { |
9fd6087b |
9 | my ($self, $arg, $proto) = @_; |
feceff29 |
10 | |
11 | die "dict called with non-dict" |
12 | if $arg->is_set and not $arg->isa('DX::Value::Dict'); |
13 | |
14 | die "dict called with non-dict prototype" |
15 | if $proto and not $proto->isa('DX::Value::Dict'); |
16 | |
17 | my $deps = [ [ TYPE_OF ,=> $arg ] ]; |
18 | |
19 | my $actions = |
20 | $arg->is_set ? [] : [ $arg->action_for_set_value($proto||dict()) ]; |
21 | |
22 | return rspace( |
23 | geometry_depends_on => $deps, |
6aa36401 |
24 | aperture => $arg->aperture_for_set_value, |
feceff29 |
25 | members => [ res( |
26 | actions => $actions, |
27 | veracity_depends_on => $deps |
28 | ) ], |
efad53c4 |
29 | ); |
30 | } |
31 | |
32 | 1; |