本文整理了Java中org.jruby.Ruby.getRespondToMissingMethod
方法的一些代码示例,展示了Ruby.getRespondToMissingMethod
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getRespondToMissingMethod
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getRespondToMissingMethod
暂无
代码示例来源:origin: org.jruby/jruby-core
@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, selfType, method, arg0, arg1);
}
// alternate logic to cache the result of respond_to if it's the standard one
if (entry.method.equals(context.runtime.getRespondToMethod())) {
String name = arg0.asJavaString();
RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, !arg1.isTrue(), context);
// only cache if it does respond_to? OR there's no custom respond_to_missing? logic
if (tuple.respondsTo.isTrue() ||
selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) {
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);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg) {
CacheEntry entry = selfType.searchWithCache(methodName);
DynamicMethod method = entry.method;
if (methodMissing(method, caller)) {
return callMethodMissing(context, self, method, arg);
}
// alternate logic to cache the result of respond_to if it's the standard one
if (entry.method.equals(context.runtime.getRespondToMethod())) {
String name = arg.asJavaString();
RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, true, context);
// only cache if it's 1.8 OR it does respond_to? OR there's no custom respond_to_missing? logic
if (!context.is19 ||
tuple.respondsTo.isTrue() ||
selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) {
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, arg);
}
代码示例来源:origin: org.jruby/jruby-complete
@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, selfType, method, arg0, arg1);
}
// alternate logic to cache the result of respond_to if it's the standard one
if (entry.method.equals(context.runtime.getRespondToMethod())) {
String name = arg0.asJavaString();
RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, !arg1.isTrue(), context);
// only cache if it does respond_to? OR there's no custom respond_to_missing? logic
if (tuple.respondsTo.isTrue() ||
selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) {
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);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@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.equals(context.runtime.getRespondToMethod())) {
String name = arg0.asJavaString();
RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, !arg1.isTrue(), context);
// only cache if it's 1.8 OR it does respond_to? OR there's no custom respond_to_missing? logic
if (!context.is19 ||
tuple.respondsTo.isTrue() ||
selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) {
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);
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg) {
CacheEntry entry = selfType.searchWithCache(methodName);
DynamicMethod method = entry.method;
if (methodMissing(method, caller)) {
return callMethodMissing(context, self, selfType, method, arg);
}
// alternate logic to cache the result of respond_to if it's the standard one
if (entry.method.isBuiltin()) {
String name = arg.asJavaString();
RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, true, context);
// only cache if it does respond_to? OR there's no custom respond_to_missing? logic
if (tuple.respondsTo.isTrue() ||
selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) {
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, arg);
}
代码示例来源:origin: org.jruby/jruby-core
@Override
protected IRubyObject cacheAndCall(IRubyObject caller, RubyClass selfType, ThreadContext context, IRubyObject self, IRubyObject arg) {
CacheEntry entry = selfType.searchWithCache(methodName);
DynamicMethod method = entry.method;
if (methodMissing(method, caller)) {
return callMethodMissing(context, self, selfType, method, arg);
}
// alternate logic to cache the result of respond_to if it's the standard one
if (entry.method.isBuiltin()) {
String name = arg.asJavaString();
RespondToTuple tuple = recacheRespondsTo(entry, name, selfType, true, context);
// only cache if it does respond_to? OR there's no custom respond_to_missing? logic
if (tuple.respondsTo.isTrue() ||
selfType.searchWithCache("respond_to_missing?").method == context.runtime.getRespondToMissingMethod()) {
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, arg);
}
代码示例来源:origin: org.jruby/jruby-core
getMetaClass().searchMethod("respond_to_missing?").equals(runtime.getRespondToMissingMethod()) ) {
return getMetaClass().respondsToMethod(name, false);
代码示例来源:origin: org.jruby/jruby-complete
getMetaClass().searchMethod("respond_to_missing?").equals(runtime.getRespondToMissingMethod()) ) {
return getMetaClass().respondsToMethod(name, false);
内容来源于网络,如有侵权,请联系作者删除!