mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* enumerator.c (enumerator_each): return self if no block is
given. [yarv-dev:882] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7621057054
commit
d4cecea858
2 changed files with 8 additions and 1 deletions
|
@ -314,10 +314,12 @@ rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv)
|
|||
static VALUE
|
||||
enumerator_each(VALUE obj)
|
||||
{
|
||||
struct enumerator *e = enumerator_ptr(obj);
|
||||
struct enumerator *e;
|
||||
int argc = 0;
|
||||
VALUE *argv = 0;
|
||||
|
||||
if (!rb_block_given_p()) return obj;
|
||||
e = enumerator_ptr(obj);
|
||||
if (e->args) {
|
||||
argc = RARRAY(e->args)->len;
|
||||
argv = RARRAY(e->args)->ptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue