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

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

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

Ruby.getFixnum介绍

[英]Retrieve the invalidator for Fixnum reopening
[中]检索Invalidater以重新打开Fixnum

代码示例

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

public RubyFixnum(Ruby runtime, long value) {
  super(runtime.getFixnum());
  this.value = value;
  this.flags |= FROZEN_F;
}

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

public RubyFixnum(Ruby runtime, long value) {
  super(runtime.getFixnum());
  this.value = value;
}

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

public RubyFixnum(Ruby runtime, long value) {
  super(runtime.getFixnum());
  this.value = value;
  this.flags |= FROZEN_F;
}

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

private static int getPositiveInt(ThreadContext context, IRubyObject arg) {
  if ( arg instanceof RubyFixnum ) {
    int value = RubyNumeric.fix2int(arg);
    if (value < 0) {
      throw context.runtime.newArgumentError("argument must be positive");
    }
    return value;
  }
  throw context.runtime.newTypeError(arg, context.runtime.getFixnum());
}

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

DefaultComparator(ThreadContext context, final boolean honorOverride) {
  this.context = context;
  if ( honorOverride && context != null ) {
    this.fixnumBypass = !honorOverride || context.runtime.getFixnum().isMethodBuiltin("<=>");
    this.stringBypass = !honorOverride || context.runtime.getString().isMethodBuiltin("<=>");
  }
  else { // no-opt
    this.fixnumBypass = false;
    this.stringBypass = false;
  }
}

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

private static int getPositiveInt(ThreadContext context, IRubyObject arg) {
  if ( arg instanceof RubyFixnum ) {
    int value = RubyNumeric.fix2int(arg);
    if (value < 0) {
      throw context.runtime.newArgumentError("argument must be positive");
    }
    return value;
  }
  throw context.runtime.newTypeError(arg, context.runtime.getFixnum());
}

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

private int getPositiveInt(ThreadContext context, IRubyObject arg) {
  Ruby runtime = context.runtime;
  if (arg instanceof RubyFixnum) {
    int value = RubyNumeric.fix2int(arg);
    if (value < 0) {
      throw runtime.newArgumentError("argument must be positive");
    }
    return value;
  } else {
    throw runtime.newTypeError(arg, runtime.getFixnum());
  }
}

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

DefaultComparator(ThreadContext context, final boolean honorOverride) {
  this.context = context;
  if ( honorOverride && context != null ) {
    this.fixnumBypass = !honorOverride || context.runtime.getFixnum().isMethodBuiltin("<=>");
    this.stringBypass = !honorOverride || context.runtime.getString().isMethodBuiltin("<=>");
  }
  else { // no-opt
    this.fixnumBypass = false;
    this.stringBypass = false;
  }
}

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

private int getPositiveInt(ThreadContext context, IRubyObject arg) {
  Ruby runtime = context.runtime;
  if (arg instanceof RubyFixnum) {
    int value = RubyNumeric.fix2int(arg);
    if (value < 0) {
      throw runtime.newArgumentError("argument must be positive");
    }
    return value;
  } else {
    throw runtime.newTypeError(arg, runtime.getFixnum());
  }
}

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

int intValue(IRubyObject obj) {
  if (obj instanceof RubyNumeric) return (int)((RubyNumeric)obj).getLongValue();
  // basically just forcing a TypeError here to match MRI
  obj = TypeConverter.convertToType(obj, obj.getRuntime().getFixnum(), "to_int", true);
  return (int)((RubyFixnum)obj).getLongValue();
}

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

int intValue(IRubyObject obj) {
  if (obj instanceof RubyNumeric) return (int)((RubyNumeric)obj).getLongValue();
  // basically just forcing a TypeError here to match MRI
  obj = TypeConverter.convertToType(obj, obj.getRuntime().getFixnum(), "to_int", true);
  return (int)((RubyFixnum)obj).getLongValue();
}

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

int intValue(IRubyObject obj) {
  if (obj instanceof RubyNumeric) return (int)((RubyNumeric)obj).getLongValue();
  // basically just forcing a TypeError here to match MRI
  obj = TypeConverter.convertToType(obj, obj.getRuntime().getFixnum(), "to_int", true);
  return (int)((RubyFixnum)obj).getLongValue();
}

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

int intValue(IRubyObject obj) {
  if (obj instanceof RubyNumeric) return (int)((RubyNumeric)obj).getLongValue();
  // basically just forcing a TypeError here to match MRI
  obj = TypeConverter.convertToType(obj, obj.getRuntime().getFixnum(), "to_int", true);
  return (int)((RubyFixnum)obj).getLongValue();
}

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

@JRubyMethod
public IRubyObject start_stream(ThreadContext context, IRubyObject encoding) {
  if (!(encoding instanceof RubyFixnum)) {
    throw context.runtime.newTypeError(encoding, context.runtime.getFixnum());
  }
  initEmitter(context, encoding);
  StreamStartEvent event = new StreamStartEvent(NULL_MARK, NULL_MARK);
  emit(context, event);
  return this;
}

代码示例来源: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: org.jruby/jruby-complete

protected void invalidateCoreClasses() {
  if (!getRuntime().isBootingCore()) {
    if (this == getRuntime().getFixnum()) {
      getRuntime().reopenFixnum();
    } else if (this == getRuntime().getFloat()) {
      getRuntime().reopenFloat();
    }
  }
}

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

protected void invalidateCoreClasses() {
  if (!getRuntime().isBooting()) {
    if (this == getRuntime().getFixnum()) {
      getRuntime().reopenFixnum();
    } else if (this == getRuntime().getFloat()) {
      getRuntime().reopenFloat();
    }
  }
}

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

protected void invalidateCoreClasses() {
  if (!getRuntime().isBootingCore()) {
    if (this == getRuntime().getFixnum()) {
      getRuntime().reopenFixnum();
    } else if (this == getRuntime().getFloat()) {
      getRuntime().reopenFloat();
    }
  }
}

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

protected void invalidateCoreClasses() {
  if (!getRuntime().isBooting()) {
    if (this == getRuntime().getFixnum()) {
      getRuntime().reopenFixnum();
    } else if (this == getRuntime().getFloat()) {
      getRuntime().reopenFloat();
    }
  }
}

相关文章

微信公众号

最新文章

更多

Ruby类方法