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

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

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

RubyClass.hasModuleInHierarchy介绍

暂无

代码示例

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

public boolean isKindOf(IRubyObject obj, RubyModule type) {
    return obj.getMetaClass().hasModuleInHierarchy(type);
  }
}

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

public boolean isKindOf(IRubyObject obj, RubyModule type) {
    return obj.getMetaClass().hasModuleInHierarchy(type);
  }
}

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

public boolean isKindOf(IRubyObject obj, RubyModule type) {
    return obj.getMetaClass().hasModuleInHierarchy(type);
  }
}

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

public boolean isKindOf(IRubyObject obj, RubyModule type) {
    return obj.getMetaClass().hasModuleInHierarchy(type);
  }
}

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

/**
 * Replaces the contents of the set with the contents of the given enumerable object and returns self.
 */
@JRubyMethod
public RubySet replace(final ThreadContext context, IRubyObject enume) {
  if ( enume instanceof RubySet ) {
    modifyCheck(context.runtime);
    clearImpl();
    addImplSet(context, (RubySet) enume);
  }
  else {
    final Ruby runtime = context.runtime;
    // do_with_enum(enum)  # make sure enum is enumerable before calling clear :
    if ( ! enume.getMetaClass().hasModuleInHierarchy(runtime.getEnumerable()) ) {
      // NOTE: likely no need to do this but due MRI compat (do_with_enum) :
      if ( ! enume.respondsTo("each_entry") ) {
        throw runtime.newArgumentError("value must be enumerable");
      }
    }
    clearImpl();
    rb_merge(context, enume);
  }
  return this;
}

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

/**
 * Replaces the contents of the set with the contents of the given enumerable object and returns self.
 */
@JRubyMethod
public RubySet replace(final ThreadContext context, IRubyObject enume) {
  if ( enume instanceof RubySet ) {
    modifyCheck(context.runtime);
    clearImpl();
    addImplSet(context, (RubySet) enume);
  }
  else {
    final Ruby runtime = context.runtime;
    // do_with_enum(enum)  # make sure enum is enumerable before calling clear :
    if ( ! enume.getMetaClass().hasModuleInHierarchy(runtime.getEnumerable()) ) {
      // NOTE: likely no need to do this but due MRI compat (do_with_enum) :
      if ( ! enume.respondsTo("each_entry") ) {
        throw runtime.newArgumentError("value must be enumerable");
      }
    }
    clearImpl();
    rb_merge(context, enume);
  }
  return this;
}

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

@JRubyMethod(name = "==", required = 1)
public static IRubyObject op_equal(ThreadContext context, IRubyObject self, IRubyObject oth) {
  if(oth.isNil()) return context.fals;
  RubyString str1, str2;
  RubyModule instance = (RubyModule)context.runtime.getModule("Digest").getConstantAt("Instance");
  if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) {
    str1 = digest(context, self, null).convertToString();
    str2 = digest(context, oth, null).convertToString();
  } else {
    str1 = to_s(context, self).convertToString();
    str2 = oth.convertToString();
  }
  boolean ret = str1.bytesize().eql(str2.bytesize()) && (str1.eql(str2));
  return ret ? context.tru : context.fals;
}

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

@JRubyMethod(name = "==", required = 1)
public static IRubyObject op_equal(ThreadContext context, IRubyObject self, IRubyObject oth) {
  if(oth.isNil()) return context.fals;
  RubyString str1, str2;
  RubyModule instance = (RubyModule)context.runtime.getModule("Digest").getConstantAt("Instance");
  if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) {
    str1 = digest(context, self, null).convertToString();
    str2 = digest(context, oth, null).convertToString();
  } else {
    str1 = to_s(context, self).convertToString();
    str2 = oth.convertToString();
  }
  boolean ret = str1.bytesize().eql(str2.bytesize()) && (str1.eql(str2));
  return ret ? context.tru : context.fals;
}

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

@JRubyMethod(name = "==", required = 1)
public static IRubyObject op_equal(ThreadContext ctx, IRubyObject self, IRubyObject oth) {
  RubyString str1, str2;
  RubyModule instance = (RubyModule)self.getRuntime().getModule("Digest").getConstantAt("Instance");
  if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) {
    str1 = digest(ctx, self, null).convertToString();
    str2 = digest(ctx, oth, null).convertToString();
  } else {
    str1 = to_s(ctx, self).convertToString();
    str2 = oth.convertToString();
  }
  boolean ret = str1.length().eql(str2.length()) && (str1.eql(str2));
  return ret ? self.getRuntime().getTrue() : self.getRuntime().getFalse();
}

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

@JRubyMethod(name = "==", required = 1)
public static IRubyObject op_equal(ThreadContext ctx, IRubyObject self, IRubyObject oth) {
  RubyString str1, str2;
  RubyModule instance = (RubyModule)self.getRuntime().getModule("Digest").getConstantAt("Instance");
  if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) {
    str1 = digest(ctx, self, null).convertToString();
    str2 = digest(ctx, oth, null).convertToString();
  } else {
    str1 = to_s(ctx, self).convertToString();
    str2 = oth.convertToString();
  }
  boolean ret = str1.length().eql(str2.length()) && (str1.eql(str2));
  return ret ? self.getRuntime().getTrue() : self.getRuntime().getFalse();
}

相关文章

微信公众号

最新文章

更多

RubyClass类方法