more eagerly bail when the state is prevented
This commit is contained in:
parent
8a167554a9
commit
15bb6e1ed7
1 changed files with 3 additions and 4 deletions
|
@ -76,6 +76,8 @@ module DeclarativePolicy
|
|||
@state = State.new
|
||||
|
||||
steps_by_score do |step, score|
|
||||
return if !debug && @state.prevented?
|
||||
|
||||
passed = nil
|
||||
case step.action
|
||||
when :enable then
|
||||
|
@ -93,10 +95,7 @@ module DeclarativePolicy
|
|||
# been prevented.
|
||||
unless @state.prevented?
|
||||
passed = step.pass?
|
||||
if passed
|
||||
@state.prevent!
|
||||
return unless debug
|
||||
end
|
||||
@state.prevent! if passed
|
||||
end
|
||||
|
||||
debug << inspect_step(step, score, passed) if debug
|
||||
|
|
Loading…
Reference in a new issue