# File lib/faster_csv.rb, line 943
    def self.dump(ary_of_objs, io = "", options = Hash.new)
      obj_template = ary_of_objs.first

      csv = FasterCSV.new(io, options)

      # write meta information
      begin
        csv << obj_template.class.csv_meta
      rescue NoMethodError
        csv << [:class, obj_template.class]
      end

      # write headers
      begin
        headers = obj_template.csv_headers
      rescue NoMethodError
        headers = obj_template.instance_variables.sort
        if obj_template.class.ancestors.find { |cls| cls.to_s =~ /\AStruct\b/ }
          headers += obj_template.members.map { |mem| "#{mem}=" }.sort
        end
      end
      csv << headers

      # serialize each object
      ary_of_objs.each do |obj|
        begin
          csv << obj.csv_dump(headers)
        rescue NoMethodError
          csv << headers.map do |var|
            if var[0] == ?@
              obj.instance_variable_get(var)
            else
              obj[var[0..-2]]
            end
          end
        end
      end

      if io.is_a? String
        csv.string
      else
        csv.close
      end
    end