IRubyObject receiver = getReceiverNode().interpret(runtime, context, self, aBlock);
IRubyObject arg = getArgsNode().interpret(runtime, context, self, aBlock);
Block block = getBlock(context, self);
if (arg instanceof RubyArray) {
RubyArray nodes = (RubyArray) arg;
switch (nodes.size()) {
case 0:
return callAdapter.call(context, self, receiver, block);
case 1:
return callAdapter.call(context, self, receiver, nodes.eltInternal(0), block);
case 2:
return callAdapter.call(context, self, receiver, nodes.eltInternal(0), nodes.eltInternal(1), block);
case 3:
return callAdapter.call(context, self, receiver, nodes.eltInternal(0), nodes.eltInternal(1), nodes.eltInternal(2), block);
default:
return callAdapter.call(context, self, receiver, nodes.toJavaArrayMaybeUnsafe(), block);
}
}
return callAdapter.call(context, self, receiver, arg, block);
}