Refine search
public static DynamicMethod selectMethodMissing(ThreadContext context, RubyClass selfClass, Visibility visibility, String name, CallType callType) { final Ruby runtime = context.runtime; if (name.equals("method_missing")) { return selectInternalMM(runtime, visibility, callType); } DynamicMethod methodMissing = selfClass.searchMethod("method_missing"); if (methodMissing.isUndefined() || methodMissing.equals(runtime.getDefaultMethodMissing())) { return selectInternalMM(runtime, visibility, callType); } return new MethodMissingMethod(methodMissing, visibility, callType); }
public static DynamicMethod selectMethodMissing(ThreadContext context, RubyClass selfClass, Visibility visibility, String name, CallType callType) { Ruby runtime = context.runtime; if (name.equals("method_missing")) { return selectInternalMM(runtime, visibility, callType); } DynamicMethod methodMissing = selfClass.searchMethod("method_missing"); if (methodMissing.isUndefined() || methodMissing.equals(runtime.getDefaultMethodMissing())) { return selectInternalMM(runtime, visibility, callType); } return new MethodMissingMethod(methodMissing, callType); }
public static DynamicMethod selectMethodMissing(ThreadContext context, RubyClass selfClass, Visibility visibility, String name, CallType callType) { Ruby runtime = context.runtime; if (name.equals("method_missing")) { return selectInternalMM(runtime, visibility, callType); } DynamicMethod methodMissing = selfClass.searchMethod("method_missing"); if (methodMissing.isUndefined() || methodMissing.equals(runtime.getDefaultMethodMissing())) { return selectInternalMM(runtime, visibility, callType); } return new MethodMissingMethod(methodMissing, callType); }
private RubyBoolean checkMetaClassBoundMethod(final ThreadContext context, final String name, final boolean includePrivate) { // getMetaClass().isMethodBound(name, !includePrivate, true) DynamicMethod method = getMetaClass().searchMethod(name); if ( ! method.isUndefined() && ! method.isNotImplemented() ) { if ( ! includePrivate && method.getVisibility() == PRIVATE ) { return context.fals; } return context.tru; } return null; }
public static DynamicMethod selectMethodMissing(RubyClass selfClass, Visibility visibility, String name, CallType callType) { Ruby runtime = selfClass.getClassRuntime(); if (name.equals("method_missing")) { return selectInternalMM(runtime, visibility, callType); } DynamicMethod methodMissing = selfClass.searchMethod("method_missing"); if (methodMissing.isUndefined() || methodMissing.equals(runtime.getDefaultMethodMissing())) { return selectInternalMM(runtime, visibility, callType); } return new MethodMissingMethod(methodMissing, visibility, callType); }
public static DynamicMethod selectMethodMissing(RubyClass selfClass, Visibility visibility, String name, CallType callType) { Ruby runtime = selfClass.getClassRuntime(); if (name.equals("method_missing")) { return selectInternalMM(runtime, visibility, callType); } DynamicMethod methodMissing = selfClass.searchMethod("method_missing"); if (methodMissing.isUndefined() || methodMissing.equals(runtime.getDefaultMethodMissing())) { return selectInternalMM(runtime, visibility, callType); } return new MethodMissingMethod(methodMissing, visibility, callType); }
public static DynamicMethod selectMethodMissing(ThreadContext context, IRubyObject receiver, Visibility visibility, String name, CallType callType) { Ruby runtime = context.runtime; if (name.equals("method_missing")) { return selectInternalMM(runtime, visibility, callType); } DynamicMethod methodMissing = receiver.getMetaClass().searchMethod("method_missing"); if (methodMissing.isUndefined() || methodMissing.equals(runtime.getDefaultMethodMissing())) { return selectInternalMM(runtime, visibility, callType); } return new MethodMissingMethod(methodMissing, visibility, callType); }
public static DynamicMethod selectMethodMissing(ThreadContext context, IRubyObject receiver, Visibility visibility, String name, CallType callType) { Ruby runtime = context.runtime; if (name.equals("method_missing")) { return selectInternalMM(runtime, visibility, callType); } DynamicMethod methodMissing = receiver.getMetaClass().searchMethod("method_missing"); if (methodMissing.isUndefined() || methodMissing.equals(runtime.getDefaultMethodMissing())) { return selectInternalMM(runtime, visibility, callType); } return new MethodMissingMethod(methodMissing, visibility, callType); }
public static DynamicMethod selectMethodMissing(ThreadContext context, IRubyObject receiver, Visibility visibility, String name, CallType callType) { Ruby runtime = context.runtime; if (name.equals("method_missing")) { return selectInternalMM(runtime, visibility, callType); } DynamicMethod methodMissing = receiver.getMetaClass().searchMethod("method_missing"); if (methodMissing.isUndefined() || methodMissing.equals(runtime.getDefaultMethodMissing())) { return selectInternalMM(runtime, visibility, callType); } return new MethodMissingMethod(methodMissing, callType); }
private DynamicMethod deepMethodSearch(String name, Ruby runtime) { DynamicMethod method = searchMethod(name); if (method.isUndefined() && isModule()) { method = runtime.getObject().searchMethod(name); } if (method.isUndefined()) { throw runtime.newNameError("undefined method '" + name + "' for " + (isModule() ? "module" : "class") + " '" + getName() + "'", name); } return method; }
private DynamicMethod deepMethodSearch(String id, Ruby runtime) { DynamicMethod method = searchMethod(id); if (method.isUndefined() && isModule()) method = runtime.getObject().searchMethod(id); if (method.isUndefined()) { RubySymbol name = runtime.newSymbol(id); throw runtime.newNameError(undefinedMethodMessage(runtime, name, rubyName(), isModule()), id); } return method; }
private DynamicMethod deepMethodSearch(String id, Ruby runtime) { DynamicMethod method = searchMethod(id); if (method.isUndefined() && isModule()) method = runtime.getObject().searchMethod(id); if (method.isUndefined()) { RubySymbol name = runtime.newSymbol(id); throw runtime.newNameError(undefinedMethodMessage(runtime, name, rubyName(), isModule()), id); } return method; }
public IRubyObject invokeInherited(ThreadContext context, IRubyObject self, IRubyObject subclass) { DynamicMethod method = getMetaClass().searchMethod("inherited"); if (method.isUndefined()) { return Helpers.callMethodMissing(context, self, method.getVisibility(), "inherited", CallType.FUNCTIONAL, Block.NULL_BLOCK); } return method.call(context, self, getMetaClass(), "inherited", subclass, Block.NULL_BLOCK); }
public IRubyObject invokeInherited(ThreadContext context, IRubyObject self, IRubyObject subclass) { DynamicMethod method = getMetaClass().searchMethod("inherited"); if (method.isUndefined()) { return Helpers.callMethodMissing(context, self, method.getVisibility(), "inherited", CallType.FUNCTIONAL, Block.NULL_BLOCK); } return method.call(context, self, getMetaClass(), "inherited", subclass, Block.NULL_BLOCK); }
private LexerSource source(ThreadContext context, IRubyObject src, String filename, int lineno) { // FIXME: respond_to? returns private methods DynamicMethod method = src.getMetaClass().searchMethod("gets"); if (method.isUndefined() || method.getVisibility() == Visibility.PRIVATE) { return new ByteListLexerSource(filename, lineno, src.convertToString().getByteList(), null); } return new GetsLexerSource(filename, lineno, src, null); }
@Interp public static IRubyObject instanceSuper(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) { RubyClass superClass = definingModule.getMethodLocation().getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(id) : UndefinedMethod.INSTANCE; IRubyObject rVal = method.isUndefined() ? Helpers.callMethodMissing(context, self, method.getVisibility(), id, CallType.SUPER, args, block) : method.call(context, self, superClass, id, args, block); return rVal; }
private LexerSource source(ThreadContext context, IRubyObject src, String filename, int lineno) { // FIXME: respond_to? returns private methods DynamicMethod method = src.getMetaClass().searchMethod("gets"); if (method.isUndefined() || method.getVisibility() == Visibility.PRIVATE) { return new ByteListLexerSource(filename, lineno, src.convertToString().getByteList(), null); } return new GetsLexerSource(filename, lineno, src, null); }
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, RubyModule klass, String name, IRubyObject arg0, Block block) { checkSuperDisabledOrOutOfMethod(context, klass, name); RubyClass selfClass = getMetaClass(self); RubyClass superClass = findImplementerIfNecessary(selfClass, klass).getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(name) : UndefinedMethod.INSTANCE; if (method.isUndefined()) { return callMethodMissing(context, self, selfClass, method.getVisibility(), name, CallType.SUPER, arg0, block); } return method.call(context, self, superClass, name, arg0, block); }
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, RubyModule klass, String name, IRubyObject[] args, Block block) { checkSuperDisabledOrOutOfMethod(context, klass, name); RubyClass selfClass = getMetaClass(self); RubyClass superClass = findImplementerIfNecessary(selfClass, klass).getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(name) : UndefinedMethod.INSTANCE; if (method.isUndefined()) { return callMethodMissing(context, self, selfClass, method.getVisibility(), name, CallType.SUPER, args, block); } return method.call(context, self, superClass, name, args, block); }
@Interp public static IRubyObject classSuper(ThreadContext context, IRubyObject self, String id, RubyModule definingModule, IRubyObject[] args, Block block) { RubyClass superClass = definingModule.getMetaClass().getMethodLocation().getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(id) : UndefinedMethod.INSTANCE; IRubyObject rVal = method.isUndefined() ? Helpers.callMethodMissing(context, self, method.getVisibility(), id, CallType.SUPER, args, block) : method.call(context, self, superClass, id, args, block); return rVal; }