final IRubyObject[] args, final Block block) {
final Ruby runtime = context.runtime;
final int len = args.length + 1;
if (block.isGiven()) {
callEach(runtime, context, self, block.arity(), new BlockCallback() {
AtomicInteger ix = new AtomicInteger(0);
public IRubyObject call(ThreadContext ctx, IRubyObject[] largs, Block blk) {
IRubyObject larg = checkArgs(runtime, largs);
RubyArray array = runtime.newArray(len);
int myIx = ix.getAndIncrement();
array.append(larg);
for (int i = 0, j = args.length; i < j; i++) {
array.append(zipEnumNext(ctx, args[i]));
}
block.yield(ctx, array);
return runtime.getNil();
}
});
return runtime.getNil();
} else {
final RubyArray zip = runtime.newArray();
callEach(runtime, context, self, Arity.ONE_REQUIRED, new BlockCallback() {
AtomicInteger ix = new AtomicInteger(0);
public IRubyObject call(ThreadContext ctx, IRubyObject[] largs, Block blk) {
IRubyObject larg = checkArgs(runtime, largs);
RubyArray array = runtime.newArray(len);