Skip to content

Instantly share code, notes, and snippets.

@lonelydimple
Created October 17, 2011 21:02
Show Gist options
  • Save lonelydimple/1293802 to your computer and use it in GitHub Desktop.
Save lonelydimple/1293802 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'state_machine'
class StringStateMachine
state_machine :state, :initial => :s do
event :a do
transition :s => :q
end
event :b do
transition :q => :r
transition :r => same
end
event :c do
transition :q => :v
transition :r => :t
transition :v => :u
transition :u => same
end
event :d do
transition :q => :t
transition :v => :t
transition :u => :t
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment