Allow comparing a Machine to a String
Allow comparing a Machine to a String

This lets us redefine model methods as FSMs, and still be able to compare:

    class SomeModel < ActiveRecord::Base
      def activate!
        state.trigger(:activate)
        save!
      end

      def state
        @_state ||= MicroMachine.new(self[:state]).tap do |fsm|
          fsm.transitions_for[:activate] = { "pending" => "active" }
          fsm.on(:any) { self[:state] = state.state }
        end
      end
    end

    model = SomeModel.new
    model.activate!
    model.state == "active"

DarthSim/micromachine,halostatue/micromachine,soveran/micromachine