From 88cff367f4ce29937fbf41f4a27cc869c5dd2a8d Mon Sep 17 00:00:00 2001 From: drbrain Date: Tue, 9 Aug 2011 00:18:18 +0000 Subject: * ext/zlib/zlib.c (gzfile_wrap): Document encoding options. * ext/zlib/zlib.c (rb_gzwriter_s_open): ditto * ext/zlib/zlib.c (rb_gzreader_s_open): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/zlib/zlib.c | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'ext') diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index b5a740df96..08963a923e 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -2762,14 +2762,17 @@ gzfile_wrap(int argc, VALUE *argv, VALUE klass, int close_io_on_error) /* * Document-method: Zlib::GzipFile.wrap * - * call-seq: Zlib::GzipFile.wrap(io) { |gz| ... } - * - * Creates a GzipFile object associated with +io+, and - * executes the block with the newly created GzipFile 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 opening, you may call - * +Zlib::GzipFile#finish+ method in the block. + * 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. */ static VALUE rb_gzfile_s_wrap(int argc, VALUE *argv, VALUE klass) @@ -3187,12 +3190,17 @@ rb_gzwriter_s_open(int argc, VALUE *argv, VALUE klass) } /* - * call-seq: Zlib::GzipWriter.new(io, level, strategy) + * call-seq: + * Zlib::GzipWriter.new(io, level = nil, strategy = nil, options = {}) * * Creates a GzipWriter object associated with +io+. +level+ and +strategy+ * should be the same as the arguments of Zlib::Deflate.new. The GzipWriter - * object writes gzipped data to +io+. At least, +io+ must respond to the - * +write+ method that behaves same as write method in IO class. + * object writes gzipped data to +io+. +io+ must respond to the + * +write+ method that behaves the same as IO#write. + * + * The +options+ hash may be used to set the encoding of the data. + * +:external_encoding+, +:internal_encoding+ and +:encoding+ may be set as in + * IO::new. */ static VALUE rb_gzwriter_initialize(int argc, VALUE *argv, VALUE obj) @@ -3388,11 +3396,16 @@ rb_gzreader_s_open(int argc, VALUE *argv, VALUE klass) /* * Document-method: Zlib::GzipReader.new * - * call-seq: Zlib::GzipReader.new(io) + * call-seq: + * Zlib::GzipReader.new(io, options = {}) * * Creates a GzipReader object associated with +io+. The GzipReader object reads - * gzipped data from +io+, and parses/decompresses them. At least, +io+ must have - * a +read+ method that behaves same as the +read+ method in IO class. + * gzipped data from +io+, and parses/decompresses it. The +io+ must + * have a +read+ method that behaves same as the IO#read. + * + * The +options+ hash may be used to set the encoding of the data. + * +:external_encoding+, +:internal_encoding+ and +:encoding+ may be set as in + * IO::new. * * If the gzip file header is incorrect, raises an Zlib::GzipFile::Error * exception. -- cgit v1.2.3