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 | |
60c182d8 |
17 | sub independent_actions { |
18 | my ($self) = @_; |
19 | return grep !@{$_->dependencies}, $self->actions; |
20 | } |
21 | |
22 | sub expand_action_dependencies { |
deec7cc4 |
23 | my ($self, $action) = @_; |
24 | my $by_id = $self->_state->by_id; |
25 | return map $by_id->{$_}->action, @{$action->dependencies}; |
26 | } |
27 | |
28 | sub value_for { |
29 | my ($self, $name) = @_; |
30 | $self->_state->scope_var($name)->bound_value; |
31 | } |
32 | |
33 | 1; |