Hierarchial Finite State Machine in Ruby