Commit | Line | Data |
deec7cc4 |
1 | package DX::Result; |
2 | |
3 | use Moo; |
4 | |
5 | has _state => (is => 'ro', required => 1, init_arg => 'state'); |
6 | |
7 | sub var_names { |
8 | sort keys %{$_[0]->_state->scope}; |
9 | } |
10 | |
11 | sub actions { |
12 | my ($self) = @_; |
13 | my $by_id = $self->_state->by_id; |
14 | return map $_->action, grep $_->has_action, values %$by_id; |
15 | } |
16 | |
17 | sub dependent_actions { |
18 | my ($self, $action) = @_; |
19 | my $by_id = $self->_state->by_id; |
20 | return map $by_id->{$_}->action, @{$action->dependencies}; |
21 | } |
22 | |
23 | sub value_for { |
24 | my ($self, $name) = @_; |
25 | $self->_state->scope_var($name)->bound_value; |
26 | } |
27 | |
28 | 1; |