@JRubyMethod(rest = true) public IRubyObject each(ThreadContext context, IRubyObject[] args, Block block) { if (args.length == 0) { return each(context, block); } IRubyObject[] newArgs = new IRubyObject[methodArgs.length + args.length]; System.arraycopy(methodArgs, 0, newArgs, 0, methodArgs.length); System.arraycopy(args, 0, newArgs, methodArgs.length, args.length); return new RubyEnumerator(context.runtime, getType(), object, context.runtime.newSymbol("each"), newArgs); }
@JRubyMethod(rest = true) public IRubyObject each(ThreadContext context, IRubyObject[] args, Block block) { if (args.length == 0) { return each(context, block); } IRubyObject[] newArgs = new IRubyObject[methodArgs.length + args.length]; System.arraycopy(methodArgs, 0, newArgs, 0, methodArgs.length); System.arraycopy(args, 0, newArgs, methodArgs.length, args.length); return new RubyEnumerator(context.runtime, getType(), object, context.runtime.newSymbol("each"), newArgs); }
@JRubyMethod(rest = true) public IRubyObject each(ThreadContext context, IRubyObject[] args, Block block) { if (args.length == 0) { return each(context, block); } final int mlen = methodArgs.length; IRubyObject[] newArgs = new IRubyObject[mlen + args.length]; ArraySupport.copy(methodArgs, newArgs, 0, mlen); ArraySupport.copy(args, newArgs, mlen, args.length); return new RubyEnumerator(context.runtime, getType(), object, context.runtime.newSymbol("each"), newArgs); }
@JRubyMethod(rest = true) public IRubyObject each(ThreadContext context, IRubyObject[] args, Block block) { if (args.length == 0) { return each(context, block); } final int mlen = methodArgs.length; IRubyObject[] newArgs = new IRubyObject[mlen + args.length]; ArraySupport.copy(methodArgs, newArgs, 0, mlen); ArraySupport.copy(args, newArgs, mlen, args.length); return new RubyEnumerator(context.runtime, getType(), object, context.runtime.newSymbol("each"), newArgs); }