def match(object)
      value = machine.read(object, :state)
      self[value, :value] || detect { |state| state.matches?(value) }
    end
def match(object)
      value = machine.read(object, :state)
      self[value, :value] || detect { |state| state.matches?(value) }
    end
Determines the current state of the given object as configured by this
 state machine.  This will attempt to find a known state that matches
 the value of the attribute on the object.

 == Examples

   class Vehicle
     state_machine :initial => :parked do
       other_states :idling
     end
   end

   states = Vehicle.state_machine.states

   vehicle = Vehicle.new         # => #<Vehicle:0xb7c464b0 @state="parked">
   states.match(vehicle)         # => #<StateMachines::State name=:parked value="parked" initial=true>

   vehicle.state = 'idling'
   states.match(vehicle)         # => #<StateMachines::State name=:idling value="idling" initial=true>

   vehicle.state = 'invalid'
   states.match(vehicle)         # => nil