def initialize_states(object, options = {}, attributes = {})
      options.assert_valid_keys( :static, :dynamic, :to)
      options = {:static => true, :dynamic => true}.merge(options)

      result = yield if block_given?

      each_value do |machine|
        unless machine.dynamic_initial_state?
          force = options[:static] == :force || !attributes.keys.map(&:to_sym).include?(machine.attribute)
          machine.initialize_state(object, force: force, :to => options[:to])
        end
      end if options[:static]

      each_value do |machine|
        machine.initialize_state(object, :force => options[:dynamic] == :force, :to => options[:to]) if machine.dynamic_initial_state?
      end if options[:dynamic]

      result
    end
def initialize_states(object, options = {}, attributes = {})
      options.assert_valid_keys( :static, :dynamic, :to)
      options = {:static => true, :dynamic => true}.merge(options)

      result = yield if block_given?

      each_value do |machine|
        unless machine.dynamic_initial_state?
          force = options[:static] == :force || !attributes.keys.map(&:to_sym).include?(machine.attribute)
          machine.initialize_state(object, force: force, :to => options[:to])
        end
      end if options[:static]

      each_value do |machine|
        machine.initialize_state(object, :force => options[:dynamic] == :force, :to => options[:to]) if machine.dynamic_initial_state?
      end if options[:dynamic]

      result
    end
Initializes the state of each machine in the given object.  This can allow
 states to be initialized in two groups: static and dynamic.  For example:

   machines.initialize_states(object) do
     # After static state initialization, before dynamic state initialization
   end

 If no block is provided, then all states will still be initialized.

 Valid configuration options:
 * <tt>:static</tt> - Whether to initialize static states. Unless set to
   false, the state will be initialized regardless of its current value.
   Default is true.
 * <tt>:dynamic</tt> - Whether to initialize dynamic states.  If set to
   :force, the state will be initialized regardless of its current value.
   Default is true.
 * <tt>:to</tt> - A hash to write the initialized state to instead of
   writing to the object.  Default is to write directly to the object.