From: Matt S Trout Date: Fri, 30 Mar 2018 16:20:07 +0000 (+0000) Subject: introduce next_step method to rspace X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FDX.git;a=commitdiff_plain;h=0c1b8f3b476762fd15436c9fd29febf980ae0b5f introduce next_step method to rspace --- diff --git a/lib/DX/ResolutionSpace.pm b/lib/DX/ResolutionSpace.pm index ab14c35..4210b02 100644 --- a/lib/DX/ResolutionSpace.pm +++ b/lib/DX/ResolutionSpace.pm @@ -1,7 +1,10 @@ package DX::ResolutionSpace; +use DX::Utils qw(step); use DX::Class; +has proposition => (is => 'ro'); + has geometry_depends_on => (is => 'ro', required => 1); has members => (is => 'ro', required => 1); @@ -18,4 +21,13 @@ sub remaining_resolution_space { return $self->but(members => [ $first->remainder, @rest ]); } +sub next_step { + my ($self) = @_; + return undef unless @{$self->members}; + return step( + resolves => $self->proposition, + resolution_space => $self, + ); +} + 1; diff --git a/lib/DX/Role/Predicate.pm b/lib/DX/Role/Predicate.pm index e2e76d6..0612168 100644 --- a/lib/DX/Role/Predicate.pm +++ b/lib/DX/Role/Predicate.pm @@ -6,12 +6,9 @@ use DX::Role; sub resolution_step_for { my ($self, $prop, @args) = @_; - my $rspace = $self->_resolution_space_for(@args); - return undef unless @{$rspace->members}; - return step( - resolves => $prop, - resolution_space => $rspace - ); + $self->_resolution_space_for(@args) + ->but(proposition => $prop) + ->next_step; } 1;