From adc9c71fbe473b18ae16b9aa0391fcbc36a39bb0 Mon Sep 17 00:00:00 2001 From: kazu Date: Sat, 10 Dec 2016 02:16:55 +0000 Subject: Fix document of gunzip and gzip [ci skip] - fix a typo (`GzipReadr` -> `GzipReader`) - `Zlib::GzipReader.new` does not take block - fix encoding git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/zlib/zlib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ext/zlib/zlib.c') diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 78860132df..956ff08b53 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -4289,7 +4289,10 @@ zlib_gzip_end(struct gzfile *gz) * * def gunzip(string) * sio = StringIO.new(string) - * Zlib::GzipReadr.new(sio){|f| f.read} + * gz = Zlib::GzipReader.new(sio, encoding: Encoding::ASCII_8BIT) + * gz.read + * ensure + * gz&.close * end * * See also Zlib.gzip @@ -4344,6 +4347,7 @@ zlib_gunzip_end(struct gzfile *gz) * * def gzip(string, level=nil, strategy=nil) * sio = StringIO.new + * sio.binmode * gz = Zlib::GzipWriter.new(sio, level, strategy) * gz.write(string) * gz.close -- cgit v1.2.3