}
@Override
protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1) {
CacheEntry entry = selfType.searchWithCache(methodName);
DynamicMethod method = entry.method;
if (methodMissing(method, caller)) {
return callMethodMissing(context, self, method, arg0, arg1);
}
// alternate logic to cache the result of respond_to if it's the standard one
if (entry.method == context.getRuntime().getRespondToMethod()) {
String name = arg0.asJavaString();
RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, !arg1.isTrue(), context);
respondToTuple = tuple;
return tuple.respondsTo;
}
// normal logic if it's not the builtin respond_to? method
cache = entry;
return method.call(context, self, selfType, methodName, arg0, arg1);
}