# File lib/dm-rails/multiparameter_attributes.rb, line 136
      def extract_multiparameter_attributes(pairs)
        attributes = {}

        for multiparameter_name, value in pairs
          unless multiparameter_name =~ /\A ([^\)]+) \(  ([0-9]+) ([a-z])?  \) \z/x
            raise "Invalid multiparameter name #{multiparameter_name.inspect}."
          end

          name, position, typecast = $1, $2, $3
          attributes[name] ||= []

          parameter_value =
            if value.empty?
              nil
            elsif typecast
              value.send('to_' + typecast)
            else
              value
            end

          attributes[name] << [ position, parameter_value ]
        end

        # Order each parameter array according to the position, then discard the
        # position.
        attributes.each { |name, values|
          attributes[name] = values.sort_by{ |v| v.first }.collect { |v| v.last }
        }
      end