本文整理了Java中org.jruby.RubyModule.isModule
方法的一些代码示例,展示了RubyModule.isModule
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.isModule
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:isModule
暂无
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static RubyModule getModuleFromPath(Ruby runtime, String path) {
RubyModule value = runtime.getClassFromPath(path);
if (!value.isModule()) throw runtime.newArgumentError(path + " does not refer module");
return value;
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyModule getSuperClassForDefined(Ruby runtime, RubyModule klazz) {
RubyModule superklazz = klazz.getSuperClass();
if (superklazz == null && klazz.isModule()) superklazz = runtime.getObject();
return superklazz;
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyModule getModuleFromPath(Ruby runtime, String path) {
final RubyModule value = getConstantFromPath(runtime, path);
if ( ! value.isModule() ) throw runtime.newArgumentError(path + " does not refer module");
return value;
}
代码示例来源:origin: org.jruby/jruby-core
public static RubyModule getModuleFromPath(Ruby runtime, String path) {
final RubyModule value = getConstantFromPath(runtime, path);
if ( ! value.isModule() ) throw runtime.newArgumentError(path + " does not refer module");
return value;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static RubyModule getSuperClassForDefined(Ruby runtime, RubyModule klazz) {
RubyModule superklazz = klazz.getSuperClass();
if (superklazz == null && klazz.isModule()) superklazz = runtime.getObject();
return superklazz;
}
代码示例来源:origin: org.jruby/jruby-core
public static RubyModule getSuperClassForDefined(Ruby runtime, RubyModule klazz) {
RubyModule superklazz = klazz.getSuperClass();
if (superklazz == null && klazz.isModule()) superklazz = runtime.getObject();
return superklazz;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static RubyModule getModuleFromPath(Ruby runtime, String path) {
RubyModule value = runtime.getClassFromPath(path);
if (!value.isModule()) throw runtime.newArgumentError(path + " does not refer module");
return value;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static RubyModule getSuperClassForDefined(Ruby runtime, RubyModule klazz) {
RubyModule superklazz = klazz.getSuperClass();
if (superklazz == null && klazz.isModule()) superklazz = runtime.getObject();
return superklazz;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
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;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
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;
}
代码示例来源:origin: org.jruby/jruby-core
public void checkValidBindTargetFrom(ThreadContext context, RubyModule originModule) throws RaiseException {
// Module methods can always be transplanted
if (!originModule.isModule() && !hasModuleInHierarchy(originModule)) {
if (originModule instanceof MetaClass) {
throw context.runtime.newTypeError("can't bind singleton method to a different class");
} else {
throw context.runtime.newTypeError("bind argument must be an instance of " + originModule.getName());
}
}
}
代码示例来源:origin: org.jruby/jruby-complete
public void checkValidBindTargetFrom(ThreadContext context, RubyModule originModule) throws RaiseException {
// Module methods can always be transplanted
if (!originModule.isModule() && !hasModuleInHierarchy(originModule)) {
if (originModule instanceof MetaClass) {
throw context.runtime.newTypeError("can't bind singleton method to a different class");
} else {
throw context.runtime.newTypeError("bind argument must be an instance of " + originModule.getName());
}
}
}
代码示例来源:origin: org.jruby/jruby-complete
private static void usingModuleRecursive(RubyModule cref, RubyModule refinedModule) {
Ruby runtime = cref.getRuntime();
RubyClass superClass = refinedModule.getSuperClass();
// For each superClass of the refined module also use their refinements for the given cref
if (superClass != null) usingModuleRecursive(cref, superClass);
RubyModule realRefinedModule;
if (refinedModule instanceof IncludedModule) {
realRefinedModule = ((IncludedModule) refinedModule).getDelegate();
} else if (refinedModule.isModule()) {
realRefinedModule = refinedModule;
} else {
throw runtime.newTypeError("wrong argument type " + refinedModule.getName() + " (expected Module)");
}
Map<RubyModule, RubyModule> refinements = realRefinedModule.refinements;
if (refinements == null) return; // No refinements registered for this module
for (Map.Entry<RubyModule, RubyModule> entry: refinements.entrySet()) {
usingRefinement(runtime, cref, entry.getKey(), entry.getValue());
}
}
代码示例来源:origin: org.jruby/jruby-core
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;
}
代码示例来源:origin: org.jruby/jruby-complete
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;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static String getPathFromClass(RubyModule clazz) {
String path = clazz.getName();
if (path.charAt(0) == '#') {
String classOrModule = clazz.isClass() ? "class" : "module";
throw clazz.getRuntime().newTypeError("can't dump anonymous " + classOrModule + " " + path);
}
RubyModule real = clazz.isModule() ? clazz : ((RubyClass)clazz).getRealClass();
if (clazz.getRuntime().getClassFromPath(path) != real) {
throw clazz.getRuntime().newTypeError(path + " can't be referred");
}
return path;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static String getPathFromClass(RubyModule clazz) {
String path = clazz.getName();
if (path.charAt(0) == '#') {
String classOrModule = clazz.isClass() ? "class" : "module";
throw clazz.getRuntime().newTypeError("can't dump anonymous " + classOrModule + " " + path);
}
RubyModule real = clazz.isModule() ? clazz : ((RubyClass)clazz).getRealClass();
if (clazz.getRuntime().getClassFromPath(path) != real) {
throw clazz.getRuntime().newTypeError(path + " can't be referred");
}
return path;
}
代码示例来源:origin: org.jruby/jruby-complete
/** rb_mod_extend_object
*
*/
@JRubyMethod(name = "extend_object", required = 1, visibility = PRIVATE)
public IRubyObject extend_object(IRubyObject obj) {
if (!isModule()) {
throw getRuntime().newTypeError(this, getRuntime().getModule());
}
obj.getSingletonClass().includeModule(this);
return obj;
}
代码示例来源:origin: org.jruby/jruby-core
/** rb_mod_extend_object
*
*/
@JRubyMethod(name = "extend_object", required = 1, visibility = PRIVATE)
public IRubyObject extend_object(IRubyObject obj) {
if (!isModule()) {
throw getRuntime().newTypeError(this, getRuntime().getModule());
}
obj.getSingletonClass().includeModule(this);
return obj;
}
代码示例来源:origin: org.jruby/jruby-core
/** rb_mod_prepend_features
*
*/
@JRubyMethod(name = "prepend_features", required = 1, visibility = PRIVATE)
public RubyModule prepend_features(IRubyObject include) {
if (!isModule()) {
throw getRuntime().newTypeError(this, getRuntime().getModule());
}
if (!(include instanceof RubyModule)) {
throw getRuntime().newTypeError(include, getRuntime().getModule());
}
if (!(include.isModule() || include.isClass())) {
throw getRuntime().newTypeError(include, getRuntime().getModule());
}
((RubyModule) include).prependModule(this);
return this;
}
内容来源于网络,如有侵权,请联系作者删除!