Skip to content

Commit

Permalink
Allow using suspended_action reference before calling the suspend method
Browse files Browse the repository at this point in the history
The usage of suspend with block to get the suspended action reference
is a bit clumsy. This should help a bit with the readability.
  • Loading branch information
iNecas committed May 6, 2015
1 parent 08a9c5b commit bfba7f3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/dynflow/action.rb
Expand Up @@ -371,9 +371,14 @@ def plan_action(action_class, *args)

# DSL for run phase

def suspended_action
phase! Run
@suspended_action ||= Action::Suspended.new(self)
end

def suspend(&block)
phase! Run
block.call Action::Suspended.new self if block
block.call suspended_action if block
throw SUSPEND, SUSPEND
end

Expand Down

0 comments on commit bfba7f3

Please sign in to comment.