member_at starting to work
[scpubgit/DX.git] / lib / DX / Step / Normal.pm
CommitLineData
9d759b64 1package DX::Step::Normal;
2
3use DX::Class;
4
5has actions => (is => 'ro', required => 1);
6
7has depends_on => (is => 'ro', required => 1);
8
9has alternative_step => (is => 'ro');
10
0498469a 11sub but_with_dependencies_on {
12 my ($self, @deps) = @_;
13 $self->but(depends_on => [ @{$self->depends_on}, @deps ]);
14}
15
9d759b64 16sub but_with_alternative_step {
17 my ($self, $step) = @_;
18 bless { %$self, alternative_step => $step }, ref($self);
19}
20
21sub apply_to {
22 my ($self, $old_hyp) = @_;
23 return ($self->_apply_to_hyp($old_hyp), $self->alternative_step);
24}
25
26sub _apply_to_hyp {
27 my ($self, $old_hyp) = @_;
28 return undef unless my $hyp = $old_hyp->with_actions(@{$self->actions});
29 return $hyp->resolve_head_dependent_on($self->depends_on);
30}
31
321;