Eric Promislow wrote:
> I'm impressed, but the name "FSM" raised my expectations.
> Is there any way you could construct an FSM, or render it,
> so its output looks more like the Flying Spaghetti Monster?

This can be a very first step into readability...

class Array
  attr_accessor :my_state_name
  alias old_inspect inspect
  def inspect
    if self.my_state_name
      (' /' + self.my_state_name + '/:' + 
old_inspect).gsub(/(\]\s*,)\s*/, "\\1\n")
    else
      old_inspect
    end
  end
end

s0 = []
s1 = []
s2 = []
s_ = []

s0.my_state_name = "Start-End State S0"
s1.my_state_name = "State S1"
s2.my_state_name = "State S2"
s_.my_state_name = "Error State S_"

fsm = [s0, s1, s2, s_]

#... rest of program ...

Wolfgang NĂ¡dasi-Donner
-- 
Posted via http://www.ruby-forum.com/.