/* :nodoc: */ static VALUE generator_each(VALUE obj) { struct generator *ptr = generator_ptr(obj); VALUE yielder; yielder = yielder_new(); return rb_proc_call(ptr->proc, rb_ary_new3(1, yielder)); }
/* :nodoc: */ static VALUE generator_each(int argc, VALUE *argv, VALUE obj) { struct generator *ptr = generator_ptr(obj); VALUE args = rb_ary_new2(argc + 1); rb_ary_push(args, yielder_new()); if (argc > 0) { rb_ary_cat(args, argv, argc); } return rb_proc_call(ptr->proc, args); }
/* :nodoc: */ static VALUE generator_init_copy(VALUE obj, VALUE orig) { struct generator *ptr0, *ptr1; ptr0 = generator_ptr(orig); Data_Get_Struct(obj, struct generator, ptr1); if (!ptr1) { rb_raise(rb_eArgError, "unallocated generator"); } ptr1->proc = ptr0->proc; return obj; }
/* :nodoc: */ static VALUE generator_init_copy(VALUE obj, VALUE orig) { struct generator *ptr0, *ptr1; if (!OBJ_INIT_COPY(obj, orig)) return obj; ptr0 = generator_ptr(orig); TypedData_Get_Struct(obj, struct generator, &generator_data_type, ptr1); if (!ptr1) { rb_raise(rb_eArgError, "unallocated generator"); } ptr1->proc = ptr0->proc; return obj; }