diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 41 |
2 files changed, 33 insertions, 14 deletions
@@ -1,3 +1,9 @@ +Tue Aug 9 09:18:04 2011 Eric Hodel <drbrain@segment7.net> + + * 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 + Sun Aug 7 23:31:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> * time.c (rb_strftime_alloc): raise ERANGE if width is too large. 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. |