def gzip(io)
      gz = StringIO.new('')
      z = Zlib::GzipWriter.new(gz)
      z.write(io.string)
      z.close

      # z was closed to write the gzip footer, so
      # now we need a new StringIO
      StringIO.new(gz.string)
    end
def gzip(io)
      gz = StringIO.new('')
      z = Zlib::GzipWriter.new(gz)
      z.write(io.string)
      z.close

      # z was closed to write the gzip footer, so
      # now we need a new StringIO
      StringIO.new(gz.string)
    end
GZip the given IO object (like a File or StringIO).

 @param [IO] io
   the io object to gzip

 @return [IO]
   the gzipped IO object