This method is equivalent to deflate('', flush). This method is just
provided to improve the readability of your Ruby program. If a block is
given chunks of deflate output are
yielded to the block until the buffer is flushed.
See Zlib::Deflate#deflate for
detail on the flush
constants NO_FLUSH, SYNC_FLUSH, FULL_FLUSH and FINISH.
static VALUE
rb_deflate_flush(int argc, VALUE *argv, VALUE obj)
{
struct zstream *z = get_zstream(obj);
VALUE v_flush;
int flush;
rb_scan_args(argc, argv, "01", &v_flush);
flush = FIXNUMARG(v_flush, Z_SYNC_FLUSH);
if (flush != Z_NO_FLUSH) { /* prevent Z_BUF_ERROR */
zstream_run(z, (Bytef*)"", 0, flush);
}
return zstream_detach_buffer(z);
}