Class: Lab42::StateMachine
- Inherits:
-
Object
- Object
- Lab42::StateMachine
- Extended by:
- Forwarder
- Defined in:
- lib/lab42/state_machine.rb,
lib/lab42/state_machine/version.rb,
lib/lab42/state_machine/controller.rb
Defined Under Namespace
Classes: Controller
Constant Summary collapse
- Version =
"0.1.1"
Instance Attribute Summary collapse
-
#subject ⇒ Object
Returns the value of attribute subject.
Instance Method Summary collapse
Instance Attribute Details
#subject ⇒ Object
Returns the value of attribute subject.
7 8 9 |
# File 'lib/lab42/state_machine.rb', line 7 def subject @subject end |
Instance Method Details
#halt_machine ⇒ Object
11 12 13 |
# File 'lib/lab42/state_machine.rb', line 11 def halt_machine raise StopIteration, "#{self} halted" end |
#run(input = []) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lab42/state_machine.rb', line 15 def run input=[] inputs = __make_inputs__ input input = nil controller.run_setups( (inputs.peek rescue nil) ) loop do input = inputs.next controller.run input end controller.run_teardowns input subject end |