class StateMachine

Public Class Methods

new() click to toggle source
# File lib/dibnahs_dogs.rb, line 53
def initialize
  @state = 0
  self.count = 4
end

Public Instance Methods

back() click to toggle source
# File lib/dibnahs_dogs.rb, line 57
def back
  self.move(-1)
end
doOne() click to toggle source
# File lib/dibnahs_dogs.rb, line 84
def doOne
  tmp = "The state machine is properly initialised"
  tmp
end
doTwo() click to toggle source
# File lib/dibnahs_dogs.rb, line 80
def doTwo
  tmp = "this is the stuff that we do at two"
  tmp
end
goto(state) click to toggle source
# File lib/dibnahs_dogs.rb, line 63
def goto(state)
  self.state = state
end
next() click to toggle source
# File lib/dibnahs_dogs.rb, line 60
def next
  self.move(1)
end
setState(state) click to toggle source
# File lib/dibnahs_dogs.rb, line 70
def setState(state)
  case state
           when state = 1    then action = doOne  # action = "this is state one"
           when state = 2    then action = doTwo # "this is state two"
           when state = 3    then action = "This is state three"
           when state = 4    then action = "this is the action for state four"
           else           puts "an error prehaps"
           end
  puts action
end
stateMachineEnd() click to toggle source
# File lib/dibnahs_dogs.rb, line 66
def stateMachineEnd
  puts 'end'
  self.clear
end