summaryrefslogtreecommitdiff
path: root/ext/zlib/zlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r--ext/zlib/zlib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 4002b75a5c..2546daade5 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -2934,6 +2934,9 @@ static VALUE
rb_gzreader_each_byte(VALUE obj)
{
VALUE c;
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
while (!NIL_P(c = rb_gzreader_getc(obj))) {
rb_yield(c);
}
@@ -3102,6 +3105,9 @@ static VALUE
rb_gzreader_each(int argc, VALUE *argv, VALUE obj)
{
VALUE str;
+
+ RETURN_ENUMERATOR(obj, 0, 0);
+
while (!NIL_P(str = gzreader_gets(argc, argv, obj))) {
rb_yield(str);
}
@@ -3361,11 +3367,13 @@ void Init_zlib()
rb_define_method(cGzipReader, "getc", rb_gzreader_getc, 0);
rb_define_method(cGzipReader, "readchar", rb_gzreader_readchar, 0);
rb_define_method(cGzipReader, "each_byte", rb_gzreader_each_byte, 0);
+ rb_define_method(cGzipReader, "bytes", rb_gzreader_each_byte, 0);
rb_define_method(cGzipReader, "ungetc", rb_gzreader_ungetc, 1);
rb_define_method(cGzipReader, "gets", rb_gzreader_gets, -1);
rb_define_method(cGzipReader, "readline", rb_gzreader_readline, -1);
rb_define_method(cGzipReader, "each", rb_gzreader_each, -1);
rb_define_method(cGzipReader, "each_line", rb_gzreader_each, -1);
+ rb_define_method(cGzipReader, "lines", rb_gzreader_each, -1);
rb_define_method(cGzipReader, "readlines", rb_gzreader_readlines, -1);
rb_define_const(mZlib, "OS_CODE", INT2FIX(OS_CODE));