method
zip
v2_5_5 -
Show latest stable
-
0 notes -
Class: Lazy
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
zip(*args)
public
Hide source
static VALUE lazy_zip(int argc, VALUE *argv, VALUE obj) { VALUE ary, v; long i; rb_block_call_func *func = lazy_zip_arrays_func; if (rb_block_given_p()) { return rb_call_super(argc, argv); } ary = rb_ary_new2(argc); for (i = 0; i < argc; i++) { v = rb_check_array_type(argv[i]); if (NIL_P(v)) { for (; i < argc; i++) { if (!rb_respond_to(argv[i], id_each)) { rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (must respond to :each)", rb_obj_class(argv[i])); } } ary = rb_ary_new4(argc, argv); func = lazy_zip_func; break; } rb_ary_push(ary, v); } return lazy_set_method(rb_block_call(rb_cLazy, id_new, 1, &obj, func, ary), ary, lazy_receiver_size); }