def initialize_state(object, options = {})
      state = initial_state(object)
      if state && (options[:force] || initialize_state?(object))
        value = state.value

        if hash = options[:to]
          hash[attribute.to_s] = value
        else
          write(object, :state, value)
        end
      end
    end
def initialize_state(object, options = {})
      state = initial_state(object)
      if state && (options[:force] || initialize_state?(object))
        value = state.value

        if hash = options[:to]
          hash[attribute.to_s] = value
        else
          write(object, :state, value)
        end
      end
    end
Initializes the state on the given object.  Initial values are only set if
 the machine's attribute hasn't been previously initialized.

 Configuration options:
 * <tt>:force</tt> - Whether to initialize the state regardless of its
   current value
 * <tt>:to</tt> - A hash to set the initial value in instead of writing
   directly to the object