org.jruby.RubyClass.getAncestorList()方法的使用及代码示例

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

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

RubyClass.getAncestorList介绍

暂无

代码示例

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

private int pendingInterruptCheckMask(ThreadContext context, IRubyObject err) {
  List<IRubyObject> ancestors = err.getMetaClass().getAncestorList();
  int ancestorsLen = ancestors.size();
  List<RubyHash> maskStack = interruptMaskStack;
  int maskStackLen = maskStack.size();
  for (int i = 0; i < maskStackLen; i++) {
    RubyHash mask = maskStack.get(maskStackLen - (i + 1));
    for (int j = 0; j < ancestorsLen; j++) {
      IRubyObject klass = ancestors.get(j);
      IRubyObject sym;
      if (!(sym = mask.op_aref(context, klass)).isNil()) {
        String symStr = sym.toString();
        switch (symStr) {
          case "immediate": return INTERRUPT_IMMEDIATE;
          case "on_blocking": return INTERRUPT_ON_BLOCKING;
          case "never": return INTERRUPT_NEVER;
          default:
            throw context.runtime.newThreadError("unknown mask signature");
        }
      }
    }
  }
  return INTERRUPT_NONE;
}

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

private int pendingInterruptCheckMask(ThreadContext context, IRubyObject err) {
  List<IRubyObject> ancestors = err.getMetaClass().getAncestorList();
  int ancestorsLen = ancestors.size();
  List<RubyHash> maskStack = interruptMaskStack;
  int maskStackLen = maskStack.size();
  for (int i = 0; i < maskStackLen; i++) {
    RubyHash mask = maskStack.get(maskStackLen - (i + 1));
    for (int j = 0; j < ancestorsLen; j++) {
      IRubyObject klass = ancestors.get(j);
      IRubyObject sym;
      if (!(sym = mask.op_aref(context, klass)).isNil()) {
        String symStr = sym.toString();
        switch (symStr) {
          case "immediate": return INTERRUPT_IMMEDIATE;
          case "on_blocking": return INTERRUPT_ON_BLOCKING;
          case "never": return INTERRUPT_NEVER;
          default:
            throw context.runtime.newThreadError("unknown mask signature");
        }
      }
    }
  }
  return INTERRUPT_NONE;
}

代码示例来源:origin: org.jenkins-ci/jruby-xstream

/**
 * Invokes all the defined read_completed methods.
 */
/*package*/ static void callReadCompleted(IRubyObject o) {
  Ruby runtime = o.getRuntime();
  RubySymbol read_completed = runtime.newSymbol("read_completed");
  List<IRubyObject> ancestors = o.getType().getAncestorList();
  for (int i = ancestors.size() - 1; i >= 0; i--) {
    RubyModule t= (RubyModule) ancestors.get(i);
    if (t.callMethod("method_defined?", read_completed).isTrue() || t.callMethod("private_method_defined?", read_completed).isTrue()) {
      ThreadContext c = runtime.getCurrentContext();
      IRubyObject m = t.callMethod("instance_method", read_completed);
      m.callMethod(c,"bind",o).callMethod(c, "call");
    }
  }
}

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

for ( IRubyObject ancestorObject: clazz.getAncestorList() ) {
  RubyModule ancestor = (RubyModule) ancestorObject;
  if (ancestor instanceof RubyClass) {

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

for ( IRubyObject ancestorObject: clazz.getAncestorList() ) {
  RubyModule ancestor = (RubyModule) ancestorObject;
  if (ancestor instanceof RubyClass) {

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

List<Class<?>> interfaceList = new ArrayList<Class<?>>();
List<IRubyObject> ancestors = clazz.getAncestorList();
boolean skipRemainingClasses = false;
for (IRubyObject ancestorObject: ancestors) {

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

List<Class<?>> interfaceList = new ArrayList<Class<?>>();
List<IRubyObject> ancestors = clazz.getAncestorList();
boolean skipRemainingClasses = false;
for (IRubyObject ancestorObject: ancestors) {

相关文章

微信公众号

最新文章

更多

RubyClass类方法