Method: Enumerator::Generator#initialize
- Defined in:
- enumerator.c
#initialize(*args) ⇒ Object
:nodoc:
1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 |
# File 'enumerator.c', line 1483
static VALUE
generator_initialize(int argc, VALUE *argv, VALUE obj)
{
VALUE proc;
if (argc == 0) {
rb_need_block();
proc = rb_block_proc();
}
else {
rb_scan_args(argc, argv, "1", &proc);
if (!rb_obj_is_proc(proc))
rb_raise(rb_eTypeError,
"wrong argument type %"PRIsVALUE" (expected Proc)",
rb_obj_class(proc));
if (rb_block_given_p()) {
rb_warn("given block not used");
}
}
return generator_init(obj, proc);
}
|