Class: StepMachine::Runner::FailureTreatment
- Inherits:
-
Object
- Object
- StepMachine::Runner::FailureTreatment
- Defined in:
- lib/step_machine/runner.rb
Instance Attribute Summary collapse
-
#step ⇒ Object
Returns the value of attribute step.
Instance Method Summary collapse
- #continue ⇒ Object
- #go_to(step_name) ⇒ Object
-
#initialize(runner, block, options) ⇒ FailureTreatment
constructor
A new instance of FailureTreatment.
- #repeat ⇒ Object
- #restart ⇒ Object
- #times(number) ⇒ Object
- #treat(step) ⇒ Object
Constructor Details
#initialize(runner, block, options) ⇒ FailureTreatment
Returns a new instance of FailureTreatment.
159 160 161 162 163 |
# File 'lib/step_machine/runner.rb', line 159 def initialize(runner, block, ) @runner = runner @block = block = end |
Instance Attribute Details
#step ⇒ Object
Returns the value of attribute step.
157 158 159 |
# File 'lib/step_machine/runner.rb', line 157 def step @step end |
Instance Method Details
#continue ⇒ Object
184 185 186 |
# File 'lib/step_machine/runner.rb', line 184 def continue go_to(@step.next.name) end |
#go_to(step_name) ⇒ Object
173 174 175 176 |
# File 'lib/step_machine/runner.rb', line 173 def go_to(step_name) @runner.next_step = @runner.step(step_name) @runner.continue = true end |
#repeat ⇒ Object
178 179 180 181 182 |
# File 'lib/step_machine/runner.rb', line 178 def repeat go_to(@step.name) @runner.repeat_what = :step self end |
#restart ⇒ Object
188 189 190 191 192 |
# File 'lib/step_machine/runner.rb', line 188 def restart go_to(@runner.first_step.name) @runner.repeat_what = :process self end |
#times(number) ⇒ Object
194 195 196 |
# File 'lib/step_machine/runner.rb', line 194 def times(number) @runner.times_to_repeat = number - 1 end |
#treat(step) ⇒ Object
165 166 167 168 169 170 171 |
# File 'lib/step_machine/runner.rb', line 165 def treat(step) return if .has_key?(:only) && ![:only].include?(step.name) return if .has_key?(:except) && [:except].include?(step.name) @step = step @block.call(self) end |