Yet, you've found a mate for your state machines in ruby, namely stachine. It's a Ruby class which enables in a rubyesque way the declaration of state-machine classes. It's easy to use and under the same license than Ruby. Feel free to use it (e.g. in a stream parser, Markovian process simulation etc.) and let me know your thoughts.

Get it at http://rubyforge.org/projects/stachine/

Sample code
 1 #!/usr/bin/env ruby
 2
 3 require 'stachine.rb'
 4
 5 class MyMachine < MateStachine
 6   
 7   def initialize
 8     @state = :initial
 9   end
10
11   state :initial, :second do 
12     def reset
13       puts "Reset done"
14       @state = :initial
15     end
16   end
17
18   state :initial do
19     def button_A
20       puts "A button pressed, changing state"
21       @state = :second
22     end
23   end
24
25   state :second do
26     def button_A
27       puts "A button pressed, remaining in this state"
28     end
29   end
30
31 end
32
33 m = MyMachine.new
34 3.times do |t|
35   m.button_A
36 end
37 m.reset
38 m.button_A
Output

A button pressed, changing state

A button pressed, remaining in this state

A button pressed, remaining in this state

Reset done

A button pressed, changing state