def write(object, attribute, value, ivar = false)
      attribute = self.attribute(attribute)
      ivar ? object.instance_variable_set("@#{attribute}", value) : object.send("#{attribute}=", value)
    end
def write(object, attribute, value, ivar = false)
      attribute = self.attribute(attribute)
      ivar ? object.instance_variable_set("@#{attribute}", value) : object.send("#{attribute}=", value)
    end
Sets a new value in the given object's attribute.

 For example,

   class Vehicle
     state_machine :initial => :parked do
       ...
     end
   end

   vehicle = Vehicle.new                                   # => #<Vehicle:0xb7d94ab0 @state="parked">
   Vehicle.state_machine.write(vehicle, :state, 'idling')  # => Equivalent to vehicle.state = 'idling'
   Vehicle.state_machine.write(vehicle, :event, 'park')    # => Equivalent to vehicle.state_event = 'park'
   vehicle.state                                           # => "idling"
   vehicle.event                                           # => "park"