class Strategy::Step
Step
encapsulates a single step in a larger plan of execution. A step contains a set of actions, which are the actual pieces of executable code, as well as a high-level description of what the step accomplishes.
Attributes
actions[R]
description[R]
Public Class Methods
new(description)
click to toggle source
Public Instance Methods
action(&block)
click to toggle source
Adds a new action to the step. Actions are given as a code block, and will be executed in the order they are added (if the step is executed).
# File lib/strategy/step.rb, line 22 def action &block if block.nil? raise RuntimeError, 'expected a block but none given' end @actions << block end
execute!()
click to toggle source
Execute all actions sequentially as they appear in the Step
.
# File lib/strategy/step.rb, line 30 def execute! @actions.each do |action| action.call end end