@Override protected boolean isSame(RubyModule module) { return delegate.isSame(module); }
@Override protected boolean isSame(RubyModule module) { return delegate.isSame(module); }
/** * Find the given class in this hierarchy, considering modules along the way. * * @param clazz the class to find * @return The method, or UndefinedMethod if not found */ public RubyModule findImplementer(RubyModule clazz) { for (RubyModule module = this; module != null; module = module.getSuperClass()) { if (module.isSame(clazz)) return module; } return null; }
/** * Find the given class in this hierarchy, considering modules along the way. * * @param clazz the class to find * @return The method, or UndefinedMethod if not found */ public RubyModule findImplementer(RubyModule clazz) { for (RubyModule module = this; module != null; module = module.getSuperClass()) { if (module.isSame(clazz)) return module; } return null; }
public boolean isKindOfModule(RubyModule type) { for (RubyModule module = this; module != null; module = module.getSuperClass()) { if (module.isSame(type)) return true; } return false; }
public boolean isKindOfModule(RubyModule type) { for (RubyModule module = this; module != null; module = module.getSuperClass()) { if (module.isSame(type)) return true; } return false; }
/** * Find the given class in this hierarchy, considering modules along the way. * * @param clazz the class to find * @return The method, or UndefinedMethod if not found */ public RubyModule findImplementer(RubyModule clazz) { for (RubyModule module = this; module != null; module = module.getSuperClass()) { if (module.isSame(clazz)) return module; } return null; }
public boolean isKindOfModule(RubyModule type) { for (RubyModule module = this; module != null; module = module.getSuperClass()) { if (module.isSame(type)) return true; } return false; }
public boolean isKindOfModule(RubyModule type) { for (RubyModule module = this; module != null; module = module.getSuperClass()) { if (module.isSame(type)) return true; } return false; }
@Override protected boolean isSame(RubyModule module) { return origin.isSame(module.getDelegate()); }
/** * Find the given class in this hierarchy, considering modules along the way. * * @param clazz the class to find * @return The method, or UndefinedMethod if not found */ public RubyModule findImplementer(RubyModule clazz) { for (RubyModule module = this; module != null; module = module.getSuperClass()) { if (module.isSame(clazz)) return module; } return null; }
@Override protected boolean isSame(RubyModule module) { return origin.isSame(module.getDelegate()); }
@JRubyMethod(name = "==", required = 1) @Override public IRubyObject op_equal(ThreadContext context, IRubyObject other) { if(!(other instanceof RubyModule)) return context.fals; RubyModule otherModule = (RubyModule) other; if(otherModule.isIncluded()) { return context.runtime.newBoolean(otherModule.isSame(this)); } else { return context.runtime.newBoolean(isSame(otherModule)); } }
@JRubyMethod(name = "==", required = 1) @Override public IRubyObject op_equal(ThreadContext context, IRubyObject other) { if(!(other instanceof RubyModule)) return context.fals; RubyModule otherModule = (RubyModule) other; if(otherModule.isIncluded()) { return context.runtime.newBoolean(otherModule.isSame(this)); } else { return context.runtime.newBoolean(isSame(otherModule)); } }
@JRubyMethod(name = "include?", required = 1) public IRubyObject include_p(ThreadContext context, IRubyObject arg) { if (!arg.isModule()) { throw context.runtime.newTypeError(arg, context.runtime.getModule()); } RubyModule moduleToCompare = (RubyModule) arg; // See if module is in chain...Cannot match against itself so start at superClass. for (RubyModule p = getSuperClass(); p != null; p = p.getSuperClass()) { if (p.isSame(moduleToCompare)) { return context.tru; } } return context.fals; }
@JRubyMethod(name = "include?", required = 1) public IRubyObject include_p(ThreadContext context, IRubyObject arg) { if (!arg.isModule()) { throw context.runtime.newTypeError(arg, context.runtime.getModule()); } RubyModule moduleToCompare = (RubyModule) arg; // See if module is in chain...Cannot match against itself so start at superClass. for (RubyModule p = getSuperClass(); p != null; p = p.getSuperClass()) { if (p.isSame(moduleToCompare)) { return context.tru; } } return context.fals; }
@JRubyMethod(name = "include?", required = 1) public IRubyObject include_p(ThreadContext context, IRubyObject arg) { if (!arg.isModule()) { throw context.runtime.newTypeError(arg, context.runtime.getModule()); } RubyModule moduleToCompare = (RubyModule) arg; // See if module is in chain...Cannot match against itself so start at superClass. for (RubyModule p = getSuperClass(); p != null; p = p.getSuperClass()) { if (p.isSame(moduleToCompare)) { return context.runtime.getTrue(); } } return context.runtime.getFalse(); }
@JRubyMethod(name = "include?", required = 1) public IRubyObject include_p(ThreadContext context, IRubyObject arg) { if (!arg.isModule()) { throw context.runtime.newTypeError(arg, context.runtime.getModule()); } RubyModule moduleToCompare = (RubyModule) arg; // See if module is in chain...Cannot match against itself so start at superClass. for (RubyModule p = getSuperClass(); p != null; p = p.getSuperClass()) { if (p.isSame(moduleToCompare)) { return context.runtime.getTrue(); } } return context.runtime.getFalse(); }