lib/archive/zip.rb
def dump(io)
      bytes_written = 0
      @entries.each do |entry|
        bytes_written += entry.dump_local_file_record(io, bytes_written)
      end
      central_directory_offset = bytes_written
      @entries.each do |entry|
        bytes_written += entry.dump_central_file_record(io)
      end
      central_directory_length = bytes_written - central_directory_offset
      bytes_written += io.write(EOCD_SIGNATURE)
      bytes_written += io.write(
        [
          0,
          0,
          @entries.length,
          @entries.length,
          central_directory_length,
          central_directory_offset,
          comment.bytesize
        ].pack('vvvvVVv')
      )
      bytes_written += io.write(comment)

      bytes_written
    end
def dump(io)
      bytes_written = 0
      @entries.each do |entry|
        bytes_written += entry.dump_local_file_record(io, bytes_written)
      end
      central_directory_offset = bytes_written
      @entries.each do |entry|
        bytes_written += entry.dump_central_file_record(io)
      end
      central_directory_length = bytes_written - central_directory_offset
      bytes_written += io.write(EOCD_SIGNATURE)
      bytes_written += io.write(
        [
          0,
          0,
          @entries.length,
          @entries.length,
          central_directory_length,
          central_directory_offset,
          comment.bytesize
        ].pack('vvvvVVv')
      )
      bytes_written += io.write(comment)

      bytes_written
    end
Writes all the entries of this archive to _io_.  _io_ must be a writable,
 IO-like object providing a _write_ method.  Returns the total number of
 bytes written.