org.jruby.Ruby.getBasicObject()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.jruby.Ruby.getBasicObject方法的一些代码示例,展示了Ruby.getBasicObject的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getBasicObject方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getBasicObject

Ruby.getBasicObject介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

private void checkNotInitialized() {
  if (superClass != null || this == runtime.getBasicObject()) {
    throw runtime.newTypeError("already initialized class");
  }
}
/** rb_check_inheritable

代码示例来源:origin: org.jruby/jruby-core

private void checkNotInitialized() {
  if (superClass != null || this == runtime.getBasicObject()) {
    throw runtime.newTypeError("already initialized class");
  }
}
/** rb_check_inheritable

代码示例来源:origin: org.jruby/jruby-complete

private static RubyClass refinementSuperclass(Ruby runtime, RubyModule module, RubyModule moduleToRefine) {
  RubyClass superClass;
  if (moduleToRefine instanceof RubyClass) {
    superClass = (RubyClass) moduleToRefine;
  } else {
    superClass = new IncludedModuleWrapper(runtime, runtime.getBasicObject(), module);
  }
  return superClass;
}

代码示例来源:origin: org.jruby/jruby-core

private static RubyClass refinementSuperclass(Ruby runtime, RubyModule module, RubyModule moduleToRefine) {
  RubyClass superClass;
  if (moduleToRefine instanceof RubyClass) {
    superClass = (RubyClass) moduleToRefine;
  } else {
    superClass = new IncludedModuleWrapper(runtime, runtime.getBasicObject(), module);
  }
  return superClass;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private void checkNotInitialized() {
  if (superClass != null || (runtime.is1_9() && this == runtime.getBasicObject())) {
    throw runtime.newTypeError("already initialized class");
  }
}
/** rb_check_inheritable

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private void checkNotInitialized() {
  if (superClass != null || (runtime.is1_9() && this == runtime.getBasicObject())) {
    throw runtime.newTypeError("already initialized class");
  }
}
/** rb_check_inheritable

代码示例来源:origin: org.jruby/jruby-complete

private void checkSafeTypeToCopy(RubyClass original) {
  Ruby runtime = getRuntime();
  if (original == runtime.getBasicObject()) throw runtime.newTypeError("can't copy the root class");
  if (getSuperClass() == runtime.getBasicObject()) throw runtime.newTypeError("already initialized class");
  if (original.isSingleton()) throw runtime.newTypeError("can't copy singleton class");
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

static void recacheBuiltinMethods(Ruby runtime) {
  RubyModule objectClass = runtime.getBasicObject();
  if (runtime.is1_9()) { // method_missing is in Kernel in 1.9
    runtime.setDefaultMethodMissing(objectClass.searchMethod("method_missing"));
  }
}

代码示例来源:origin: org.jruby/jruby-core

private void checkSafeTypeToCopy(RubyClass original) {
  Ruby runtime = getRuntime();
  if (original == runtime.getBasicObject()) throw runtime.newTypeError("can't copy the root class");
  if (getSuperClass() == runtime.getBasicObject()) throw runtime.newTypeError("already initialized class");
  if (original.isSingleton()) throw runtime.newTypeError("can't copy singleton class");
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

static void recacheBuiltinMethods(Ruby runtime) {
  RubyModule objectClass = runtime.getBasicObject();
  if (runtime.is1_9()) { // method_missing is in Kernel in 1.9
    runtime.setDefaultMethodMissing(objectClass.searchMethod("method_missing"));
  }
}

代码示例来源:origin: org.jruby/jruby-complete

static void recacheBuiltinMethods(Ruby runtime) {
  RubyModule objectClass = runtime.getBasicObject();
  // Since method_missing is marked module we actually define two builtin versions
  runtime.setDefaultMethodMissing(objectClass.searchMethod("method_missing"),
      objectClass.getMetaClass().searchMethod("method_missing"));
}

代码示例来源:origin: org.jruby/jruby-core

static void recacheBuiltinMethods(Ruby runtime) {
  RubyModule objectClass = runtime.getBasicObject();
  // Since method_missing is marked module we actually define two builtin versions
  runtime.setDefaultMethodMissing(objectClass.searchMethod("method_missing"),
      objectClass.getMetaClass().searchMethod("method_missing"));
}

代码示例来源:origin: org.jruby/jruby-complete

/** Return the real super class of this class.
 *
 * rb_class_superclass
 *
 */
@JRubyMethod(name = "superclass")
public IRubyObject superclass(ThreadContext context) {
  RubyClass superClazz = superClass;
  if (superClazz == null) {
    if (metaClass == runtime.getBasicObject().getMetaClass()) return context.nil;
    throw runtime.newTypeError("uninitialized class");
  }
  while (superClazz != null && (superClazz.isIncluded() || superClazz.isPrepended())) {
    superClazz = superClazz.superClass;
  }
  return superClazz != null ? superClazz : context.nil;
}

代码示例来源:origin: org.jruby/jruby-core

/** Return the real super class of this class.
 *
 * rb_class_superclass
 *
 */
@JRubyMethod(name = "superclass")
public IRubyObject superclass(ThreadContext context) {
  RubyClass superClazz = superClass;
  if (superClazz == null) {
    if (metaClass == runtime.getBasicObject().getMetaClass()) return context.nil;
    throw runtime.newTypeError("uninitialized class");
  }
  while (superClazz != null && (superClazz.isIncluded() || superClazz.isPrepended())) {
    superClazz = superClazz.superClass;
  }
  return superClazz != null ? superClazz : context.nil;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "allocate")
public IRubyObject allocate() {
  if (superClass == null) {
    if (this != runtime.getBasicObject()) {
      throw runtime.newTypeError("can't instantiate uninitialized class");
    }
  }
  IRubyObject obj = allocator.allocate(runtime, this);
  if (getMetaClass(obj).getRealClass() != getRealClass()) {
    throw runtime.newTypeError("wrong instance allocation");
  }
  return obj;
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "allocate")
public IRubyObject allocate() {
  if (superClass == null) {
    if (this != runtime.getBasicObject()) {
      throw runtime.newTypeError("can't instantiate uninitialized class");
    }
  }
  IRubyObject obj = allocator.allocate(runtime, this);
  if (getMetaClass(obj).getRealClass() != getRealClass()) {
    throw runtime.newTypeError("wrong instance allocation");
  }
  return obj;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/** Return the real super class of this class.
 * 
 * rb_class_superclass
 *
 */    
@JRubyMethod(name = "superclass")
public IRubyObject superclass(ThreadContext context) {
  RubyClass superClazz = superClass;
  
  if (superClazz == null) {
    if (runtime.is1_9() && metaClass == runtime.getBasicObject().getMetaClass()) return runtime.getNil();
    throw runtime.newTypeError("uninitialized class");
  }
  while (superClazz != null && superClazz.isIncluded()) superClazz = superClazz.superClass;
  return superClazz != null ? superClazz : runtime.getNil();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "allocate")
public IRubyObject allocate() {
  if (superClass == null) {
    if(!(runtime.is1_9() && this == runtime.getBasicObject())) {
      throw runtime.newTypeError("can't instantiate uninitialized class");
    }
  }
  IRubyObject obj = allocator.allocate(runtime, this);
  if (obj.getMetaClass().getRealClass() != getRealClass()) {
    throw runtime.newTypeError("wrong instance allocation");
  }
  return obj;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** Return the real super class of this class.
 * 
 * rb_class_superclass
 *
 */    
@JRubyMethod(name = "superclass")
public IRubyObject superclass(ThreadContext context) {
  RubyClass superClazz = superClass;
  
  if (superClazz == null) {
    if (runtime.is1_9() && metaClass == runtime.getBasicObject().getMetaClass()) return runtime.getNil();
    throw runtime.newTypeError("uninitialized class");
  }
  while (superClazz != null && superClazz.isIncluded()) superClazz = superClazz.superClass;
  return superClazz != null ? superClazz : runtime.getNil();
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "allocate")
public IRubyObject allocate() {
  if (superClass == null) {
    if(!(runtime.is1_9() && this == runtime.getBasicObject())) {
      throw runtime.newTypeError("can't instantiate uninitialized class");
    }
  }
  IRubyObject obj = allocator.allocate(runtime, this);
  if (obj.getMetaClass().getRealClass() != getRealClass()) {
    throw runtime.newTypeError("wrong instance allocation");
  }
  return obj;
}

相关文章

Ruby类方法