summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-04 18:25:16 (GMT)
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-04 18:25:16 (GMT)
commit69846644d25b0a40ab787b150716a5d17e63f6a8 (patch)
treee2f3fc0fdbfaddcd5a7187dcc631c0103e28f1b1 /enum.c
parent468301b98487d3b2b0d9e4a60c912803f4ba39f0 (diff)
* enum.c: Make Enumerable#chunk with no block return
an Enumerator [#2172] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/enum.c b/enum.c
index 84f6a6f..625097c 100644
--- a/enum.c
+++ b/enum.c
@@ -2995,14 +2995,14 @@ chunk_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
* }
* }
*
+ * If no block is given, an enumerator to `chunk` is returned instead.
*/
static VALUE
enum_chunk(VALUE enumerable)
{
VALUE enumerator;
- if (!rb_block_given_p())
- rb_raise(rb_eArgError, "no block given");
+ RETURN_SIZED_ENUMERATOR(enumerable, 0, 0, enum_size);
enumerator = rb_obj_alloc(rb_cEnumerator);
rb_ivar_set(enumerator, rb_intern("chunk_enumerable"), enumerable);