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

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

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

RubyModule.setInternalModuleVariable介绍

[英]Behaves similarly to #setClassVar(String,IRubyObject). If the specified internal variable is found in this class/module or an ancestor, it is set where found. Otherwise it is set in this module.
[中]行为类似于#setClassVar(字符串,IRubyObject)。如果在这个类/模块或祖先中找到指定的内部变量,则在找到的地方设置它。否则在本模块中设置。

代码示例

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

private static IRubyObject modeExecute(final ThreadContext context, final RubyModule BigDecimal,
  final Block block, final String intVariableName) {
  IRubyObject current = BigDecimal.searchInternalModuleVariable(intVariableName);
  try {
    return block.yieldSpecific(context);
  }
  finally {
    BigDecimal.setInternalModuleVariable(intVariableName, current);
  }
}

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

private static IRubyObject modeExecute(final ThreadContext context, final RubyModule BigDecimal,
  final Block block, final String intVariableName) {
  IRubyObject current = BigDecimal.searchInternalModuleVariable(intVariableName);
  try {
    return block.yieldSpecific(context);
  }
  finally {
    BigDecimal.setInternalModuleVariable(intVariableName, current);
  }
}

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

@JRubyMethod(name = "save_limit", meta = true)
public static IRubyObject save_limit(ThreadContext context, IRubyObject recv, Block block) {
  RubyModule c = (RubyModule)recv;
  IRubyObject nCur = c.searchInternalModuleVariable("vpPrecLimit");
  IRubyObject ret;
  try {
    ret = block.yieldSpecific(context);
  } finally {
    c.setInternalModuleVariable("vpPrecLimit", nCur);
  }
  return ret;
}

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

@JRubyMethod(name = "save_rounding_mode", meta = true)
public static IRubyObject save_rounding_mode(ThreadContext context, IRubyObject recv, Block block) {
  RubyModule c = (RubyModule)recv;
  IRubyObject nCur = c.searchInternalModuleVariable("vpRoundingMode");
  IRubyObject ret;
  try {
    ret = block.yieldSpecific(context);
  } finally {
    c.setInternalModuleVariable("vpRoundingMode", nCur);
  }
  return ret;
}

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

@JRubyMethod(name = "save_exception_mode", meta = true)
public static IRubyObject save_exception_mode(ThreadContext context, IRubyObject recv, Block block) {
  RubyModule c = (RubyModule)recv;
  IRubyObject nCur = c.searchInternalModuleVariable("vpExceptionMode");
  IRubyObject ret;
  try {
    ret = block.yieldSpecific(context);
  } finally {
    c.setInternalModuleVariable("vpExceptionMode", nCur);
  }
  return ret;
}

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

@JRubyMethod(name = "save_limit", meta = true)
public static IRubyObject save_limit(ThreadContext context, IRubyObject recv, Block block) {
  RubyModule c = (RubyModule)recv;
  IRubyObject nCur = c.searchInternalModuleVariable("vpPrecLimit");
  IRubyObject ret;
  try {
    ret = block.yieldSpecific(context);
  } finally {
    c.setInternalModuleVariable("vpPrecLimit", nCur);
  }
  return ret;
}

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

@JRubyMethod(name = "save_rounding_mode", meta = true)
public static IRubyObject save_rounding_mode(ThreadContext context, IRubyObject recv, Block block) {
  RubyModule c = (RubyModule)recv;
  IRubyObject nCur = c.searchInternalModuleVariable("vpRoundingMode");
  IRubyObject ret;
  try {
    ret = block.yieldSpecific(context);
  } finally {
    c.setInternalModuleVariable("vpRoundingMode", nCur);
  }
  return ret;
}

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

@JRubyMethod(name = "save_exception_mode", meta = true)
public static IRubyObject save_exception_mode(ThreadContext context, IRubyObject recv, Block block) {
  RubyModule c = (RubyModule)recv;
  IRubyObject nCur = c.searchInternalModuleVariable("vpExceptionMode");
  IRubyObject ret;
  try {
    ret = block.yieldSpecific(context);
  } finally {
    c.setInternalModuleVariable("vpExceptionMode", nCur);
  }
  return ret;
}

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

/**
 * Set new vpPrecLimit if Fixnum and return the old value.
 */
@JRubyMethod(meta = true)
public static IRubyObject limit(ThreadContext context, IRubyObject recv, IRubyObject arg) {
  IRubyObject old = limit(context, recv);
  if (arg == context.nil) return old;
  if (!(arg instanceof RubyFixnum)) throw context.runtime.newTypeError(arg, context.runtime.getFixnum());
  if (0 > ((RubyFixnum)arg).getLongValue()) throw context.runtime.newArgumentError("argument must be positive");
  ((RubyModule) recv).setInternalModuleVariable("vpPrecLimit", arg);
  return old;
}

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

/**
 * Set new vpPrecLimit if Fixnum and return the old value.
 */
@JRubyMethod(meta = true)
public static IRubyObject limit(ThreadContext context, IRubyObject recv, IRubyObject arg) {
  IRubyObject old = limit(context, recv);
  if (arg == context.nil) return old;
  if (!(arg instanceof RubyFixnum)) throw context.runtime.newTypeError(arg, context.runtime.getFixnum());
  if (0 > ((RubyFixnum)arg).getLongValue()) throw context.runtime.newArgumentError("argument must be positive");
  ((RubyModule) recv).setInternalModuleVariable("vpPrecLimit", arg);
  return old;
}

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

@JRubyMethod(name = "limit", optional = 1, meta = true)
public static IRubyObject limit(IRubyObject recv, IRubyObject[] args) {
  Ruby runtime = recv.getRuntime();
  RubyModule c = (RubyModule)recv;
  IRubyObject nCur = c.searchInternalModuleVariable("vpPrecLimit");
  if (args.length > 0) {
    IRubyObject arg = args[0];
    if (!arg.isNil()) {
      if (!(arg instanceof RubyFixnum)) {
        throw runtime.newTypeError(arg, runtime.getFixnum());
      }
      if (0 > ((RubyFixnum)arg).getLongValue()) {
        throw runtime.newArgumentError("argument must be positive");
      }
      c.setInternalModuleVariable("vpPrecLimit", arg);
    }
  }
  return nCur;
}

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

@JRubyMethod(name = "limit", optional = 1, meta = true)
public static IRubyObject limit(IRubyObject recv, IRubyObject[] args) {
  Ruby runtime = recv.getRuntime();
  RubyModule c = (RubyModule)recv;
  IRubyObject nCur = c.searchInternalModuleVariable("vpPrecLimit");
  if (args.length > 0) {
    IRubyObject arg = args[0];
    if (!arg.isNil()) {
      if (!(arg instanceof RubyFixnum)) {
        throw runtime.newTypeError(arg, runtime.getFixnum());
      }
      if (0 > ((RubyFixnum)arg).getLongValue()) {
        throw runtime.newArgumentError("argument must be positive");
      }
      c.setInternalModuleVariable("vpPrecLimit", arg);
    }
  }
  return nCur;
}

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

c.setInternalModuleVariable("vpExceptionMode", fixnumMode);
return fixnumMode;
c.setInternalModuleVariable("vpRoundingMode", roundingMode);

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

c.setInternalModuleVariable("vpExceptionMode", fixnumMode);
return fixnumMode;
c.setInternalModuleVariable("vpRoundingMode", roundingMode);

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

: (RubyFixnum)currentExceptionMode.callCoerced(context, "&", new RubyFixnum(runtime, ~(EXCEPTION_OVERFLOW).getLongValue()));
c.setInternalModuleVariable("vpExceptionMode", newExceptionMode);
return newExceptionMode;
    roundingMode == clazz.getConstant("ROUND_HALF_DOWN") ||
    roundingMode == clazz.getConstant("ROUND_HALF_EVEN")) {
  c.setInternalModuleVariable("vpRoundingMode", roundingMode);
} else {
  throw runtime.newTypeError("invalid rounding mode");

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

: (RubyFixnum)currentExceptionMode.callCoerced(context, "&", new RubyFixnum(runtime, ~(EXCEPTION_OVERFLOW).getLongValue()));
c.setInternalModuleVariable("vpExceptionMode", newExceptionMode);
return newExceptionMode;
    roundingMode == clazz.getConstant("ROUND_HALF_DOWN") ||
    roundingMode == clazz.getConstant("ROUND_HALF_EVEN")) {
  c.setInternalModuleVariable("vpRoundingMode", roundingMode);
} else {
  throw runtime.newTypeError("invalid rounding mode");

相关文章

微信公众号

最新文章

更多

RubyModule类方法