Project

General

Profile

Feature #13904 ยป poc.diff

znz (Kazuhiro NISHIYAMA), 09/15/2017 03:27 PM

View differences:

enumerator.c
return e->size;
}
static VALUE
enumerator_receiver(VALUE obj)
{
struct enumerator *e;
VALUE eobj;
TypedData_Get_Struct(obj, struct enumerator, &enumerator_data_type, e);
eobj = rb_attr_get(obj, id_receiver);
if (NIL_P(eobj)) {
eobj = e->obj;
}
return eobj;
}
static VALUE
enumerator_method_name(VALUE obj)
{
struct enumerator *e;
TypedData_Get_Struct(obj, struct enumerator, &enumerator_data_type, e);
return ID2SYM(e->meth);
}
static VALUE
enumerator_arguments(VALUE obj)
{
struct enumerator *e;
TypedData_Get_Struct(obj, struct enumerator, &enumerator_data_type, e);
return e->args;
}
/*
* Yielder
*/
......
rb_define_method(rb_cEnumerator, "rewind", enumerator_rewind, 0);
rb_define_method(rb_cEnumerator, "inspect", enumerator_inspect, 0);
rb_define_method(rb_cEnumerator, "size", enumerator_size, 0);
rb_define_method(rb_cEnumerator, "receiver", enumerator_receiver, 0);
rb_define_method(rb_cEnumerator, "method_name", enumerator_method_name, 0);
rb_define_method(rb_cEnumerator, "arguments", enumerator_arguments, 0);
/* Lazy */
rb_cLazy = rb_define_class_under(rb_cEnumerator, "Lazy", rb_cEnumerator);
    (1-1/1)