@JRubyMethod public RubyNumeric max(ThreadContext context) { return RubyNumeric.int2fix(context.runtime, capacity); }
@JRubyMethod(name = {"length", "size"}) public RubyNumeric length(ThreadContext context) { initializedCheck(); return RubyNumeric.int2fix(context.runtime, count.get()); }
@JRubyMethod(name = {"length", "size"}) public RubyNumeric length(ThreadContext context) { initializedCheck(); return RubyNumeric.int2fix(context.runtime, count.get()); }
@JRubyMethod(name = {"length", "size"}) public synchronized RubyNumeric length(ThreadContext context) { checkShutdown(context); return RubyNumeric.int2fix(context.runtime, entries.size()); }
/** * Read a byte. On EOF returns nil. */ // rb_io_getbyte @JRubyMethod public IRubyObject getbyte(ThreadContext context) { int c = getByte(context); if (c == -1) return context.nil; return RubyNumeric.int2fix(context.runtime, c & 0xff); }
@JRubyMethod(name = "left", visibility = PRIVATE) public IRubyObject leftObj(ThreadContext context) { return RubyNumeric.int2fix(context.runtime, random.getLeft()); }
@JRubyMethod(name = {"pos", "tell"}) public IRubyObject pos() { return RubyNumeric.int2fix(getRuntime(), position); }
/** * Read a byte. On EOF returns nil. */ // rb_io_getbyte @JRubyMethod public IRubyObject getbyte(ThreadContext context) { int c = getByte(context); if (c == -1) return context.nil; return RubyNumeric.int2fix(context.runtime, c & 0xff); }
private IRubyObject getWorldMode(ThreadContext context, int mode) { checkInitialized(); if ((stat.mode() & mode) == mode) { return RubyNumeric.int2fix(context.runtime, (stat.mode() & (S_IRUGO | S_IWUGO | S_IXUGO) )); } return context.nil; } }
private IRubyObject getWorldMode(ThreadContext context, int mode) { checkInitialized(); if ((stat.mode() & mode) == mode) { return RubyNumeric.int2fix(context.runtime, (stat.mode() & (S_IRUGO | S_IWUGO | S_IXUGO) )); } return context.nil; } }
private IRubyObject getWorldMode(ThreadContext context, int mode) { if ((stat.mode() & mode) == mode) { return RubyNumeric.int2fix(context.runtime, (stat.mode() & (S_IRUGO | S_IWUGO | S_IXUGO) )); } return context.runtime.getNil(); } }
@JRubyMethod(name = {"pos", "tell"}) public IRubyObject pos() { return RubyNumeric.int2fix(getRuntime(), io.getTotalIn()); }
private IRubyObject getWorldMode(ThreadContext context, int mode) { if ((stat.mode() & mode) == mode) { return RubyNumeric.int2fix(context.runtime, (stat.mode() & (S_IRUGO | S_IWUGO | S_IXUGO) )); } return context.runtime.getNil(); } }
@JRubyMethod(name = {"pos", "tell"}) public IRubyObject pos() { return RubyNumeric.int2fix(getRuntime(), io.getTotalIn()); }
@JRubyMethod(name = "left", meta = true, visibility = PRIVATE) public static IRubyObject left(ThreadContext context, IRubyObject recv) { return RubyNumeric.int2fix(context.runtime, getDefaultRand(context).getLeft()); }
@JRubyMethod(name = "left", meta = true, visibility = PRIVATE) public static IRubyObject left(ThreadContext context, IRubyObject recv) { return RubyNumeric.int2fix(context.runtime, getDefaultRand(context).getLeft()); }
@JRubyMethod(name = {"to_i", "to_int"}, compat = CompatVersion.RUBY1_8) public IRubyObject to_int() { if (isNaN() || infinitySign != 0) { return getRuntime().getNil(); } try { return RubyNumeric.int2fix(getRuntime(), value.longValueExact()); } catch (ArithmeticException ae) { return RubyBignum.bignorm(getRuntime(), value.toBigInteger()); } }
@JRubyMethod(name = {"to_i", "to_int"}, compat = CompatVersion.RUBY1_8) public IRubyObject to_int() { if (isNaN() || infinitySign != 0) { return getRuntime().getNil(); } try { return RubyNumeric.int2fix(getRuntime(), value.longValueExact()); } catch (ArithmeticException ae) { return RubyBignum.bignorm(getRuntime(), value.toBigInteger()); } }
@JRubyMethod(name = "marshal_dump", compat = RUBY1_9) public IRubyObject marshal_dump(ThreadContext context) { RubyBignum state = random.getState(); RubyInteger left = (RubyInteger) RubyNumeric.int2fix(context.runtime, random.getLeft()); RubyArray dump = context.runtime.newArray(state, left, random.getSeed()); if (hasVariables()) { dump.syncVariables(this); } return dump; }
@JRubyMethod(name = "marshal_dump", compat = RUBY1_9) public IRubyObject marshal_dump(ThreadContext context) { RubyBignum state = random.getState(); RubyInteger left = (RubyInteger) RubyNumeric.int2fix(context.runtime, random.getLeft()); RubyArray dump = context.runtime.newArray(state, left, random.getSeed()); if (hasVariables()) { dump.syncVariables(this); } return dump; }