Method: Zlib::GzipFile.wrap

Defined in:
zlib.c

.wrap(*args) ⇒ Object

call-seq:

Zlib::GzipReader.wrap(io, ...) { |gz| ... }
Zlib::GzipWriter.wrap(io, ...) { |gz| ... }

Creates a GzipReader or GzipWriter associated with io, passing in any necessary extra options, and executes the block with the newly created object just like File.open.

The GzipFile object will be closed automatically after executing the block. If you want to keep the associated IO object open, you may call Zlib::GzipFile#finish method in the block.



3084
3085
3086
3087
3088
# File 'zlib.c', line 3084

static VALUE
rb_gzfile_s_wrap(int argc, VALUE *argv, VALUE klass)
{
    return gzfile_wrap(argc, argv, klass, 0);
}