File: traffic_light.rb

package info (click to toggle)
ruby-state-machine 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,764 kB
  • ctags: 6,623
  • sloc: ruby: 26,008; makefile: 11
file content (9 lines) | stat: -rw-r--r-- 195 bytes parent folder | download
1
2
3
4
5
6
7
8
9
require 'state_machine'

class TrafficLight
  state_machine :initial => :stop do
    event :cycle do
      transition :stop => :proceed, :proceed => :caution, :caution => :stop
    end
  end
end