fold_array (XmlSimple)

    # File lib/xmlsimple.rb, line 564
      def fold_array(array)
        hash = Hash.new
        array.each { |x|
          return array unless x.instance_of?(Hash)
          key_matched = false
          @options['keyattr'].each { |key|
            if x.has_key?(key)
              key_matched = true
              value = x[key]
              return array if value.instance_of?(Hash) || value.instance_of?(Array)
              value = normalise_space(value) if @options['normalisespace'] == 1
              x.delete(key)
              hash[value] = x
              break
            end
          }
          return array unless key_matched
        }
        hash = collapse_content(hash) if @options['collapseagain']
        hash
      end