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

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

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

RubyClass.setInternalModuleVariable介绍

暂无

代码示例

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

public static RubyClass createBigDecimal(Ruby runtime) {
  RubyClass bigDecimal = runtime.defineClass("BigDecimal", runtime.getNumeric(), BIGDECIMAL_ALLOCATOR);
  runtime.getKernel().defineAnnotatedMethods(BigDecimalKernelMethods.class);
  bigDecimal.setInternalModuleVariable("vpPrecLimit", RubyFixnum.zero(runtime));
  bigDecimal.setInternalModuleVariable("vpExceptionMode", RubyFixnum.zero(runtime));
  bigDecimal.setInternalModuleVariable("vpRoundingMode", runtime.newFixnum(ROUND_HALF_UP));
  
  bigDecimal.defineAnnotatedMethods(RubyBigDecimal.class);
  bigDecimal.defineAnnotatedConstants(RubyBigDecimal.class);
  if (runtime.is1_9()) {
    RubyModule bigMath = runtime.defineModule("BigMath");
    // TODO: BigMath.exp and BigMath.pow in native code
    bigDecimal.defineConstant("NAN", newNaN(runtime));
    bigDecimal.defineConstant("INFINITY", newInfinity(runtime, 1));
  }
  return bigDecimal;
}

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

public static RubyClass createBigDecimal(Ruby runtime) {
  RubyClass bigDecimal = runtime.defineClass("BigDecimal", runtime.getNumeric(), BIGDECIMAL_ALLOCATOR);
  runtime.getKernel().defineAnnotatedMethods(BigDecimalKernelMethods.class);
  bigDecimal.setInternalModuleVariable("vpPrecLimit", RubyFixnum.zero(runtime));
  bigDecimal.setInternalModuleVariable("vpExceptionMode", RubyFixnum.zero(runtime));
  bigDecimal.setInternalModuleVariable("vpRoundingMode", runtime.newFixnum(ROUND_HALF_UP));
  
  bigDecimal.defineAnnotatedMethods(RubyBigDecimal.class);
  bigDecimal.defineAnnotatedConstants(RubyBigDecimal.class);
  if (runtime.is1_9()) {
    RubyModule bigMath = runtime.defineModule("BigMath");
    // TODO: BigMath.exp and BigMath.pow in native code
    bigDecimal.defineConstant("NAN", newNaN(runtime));
    bigDecimal.defineConstant("INFINITY", newInfinity(runtime, 1));
  }
  return bigDecimal;
}

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

public static RubyClass createBigDecimal(Ruby runtime) {
  RubyClass bigDecimal = runtime.defineClass("BigDecimal", runtime.getNumeric(), ALLOCATOR);
  bigDecimal.setConstant("VERSION", RubyString.newStringShared(runtime, VERSION));
  runtime.getKernel().defineAnnotatedMethods(BigDecimalKernelMethods.class);
  bigDecimal.setInternalModuleVariable("vpPrecLimit", RubyFixnum.zero(runtime));
  bigDecimal.setInternalModuleVariable("vpExceptionMode", RubyFixnum.zero(runtime));
  bigDecimal.setInternalModuleVariable("vpRoundingMode", runtime.newFixnum(ROUND_HALF_UP));
  bigDecimal.defineAnnotatedMethods(RubyBigDecimal.class);
  bigDecimal.defineAnnotatedConstants(RubyBigDecimal.class);
  //RubyModule bigMath = runtime.defineModule("BigMath");
  // NOTE: BigMath.exp and BigMath.pow should be implemented as native
  // for now @see jruby/bigdecimal.rb
  bigDecimal.defineConstant("NAN", newNaN(runtime));
  bigDecimal.defineConstant("INFINITY", newInfinity(runtime, 1));
  
  bigDecimal.setReifiedClass(RubyBigDecimal.class);
  return bigDecimal;
}

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

public static RubyClass createBigDecimal(Ruby runtime) {
  RubyClass bigDecimal = runtime.defineClass("BigDecimal", runtime.getNumeric(), ALLOCATOR);
  bigDecimal.setConstant("VERSION", RubyString.newStringShared(runtime, VERSION));
  runtime.getKernel().defineAnnotatedMethods(BigDecimalKernelMethods.class);
  bigDecimal.setInternalModuleVariable("vpPrecLimit", RubyFixnum.zero(runtime));
  bigDecimal.setInternalModuleVariable("vpExceptionMode", RubyFixnum.zero(runtime));
  bigDecimal.setInternalModuleVariable("vpRoundingMode", runtime.newFixnum(ROUND_HALF_UP));
  bigDecimal.defineAnnotatedMethods(RubyBigDecimal.class);
  bigDecimal.defineAnnotatedConstants(RubyBigDecimal.class);
  //RubyModule bigMath = runtime.defineModule("BigMath");
  // NOTE: BigMath.exp and BigMath.pow should be implemented as native
  // for now @see jruby/bigdecimal.rb
  bigDecimal.defineConstant("NAN", newNaN(runtime));
  bigDecimal.defineConstant("INFINITY", newInfinity(runtime, 1));
  
  bigDecimal.setReifiedClass(RubyBigDecimal.class);
  return bigDecimal;
}

相关文章

微信公众号

最新文章

更多

RubyClass类方法