instance method
Zlib::Deflate#flush
(?::Integer flush) -> ::String
(?::Integer flush) { (::String chunk) -> nil } -> nil
flush(flush = Zlib::SYNC_FLUSH) → String
flush(flush = Zlib::SYNC_FLUSH) { |chunk| ... } → nil
ext/zlib/zlib.c
View on GitHub ↗
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);
}
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.