public IRubyObject op_equal(ThreadContext context, double other) { if (Double.isNaN(value)) { return context.fals; } return RubyBoolean.newBoolean(context.runtime, value == other); }
private IRubyObject op_equalOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return RubyBoolean.newBoolean(context.runtime, BigInteger.valueOf(this.value).compareTo(((RubyBignum) other).value) == 0); } if (other instanceof RubyFloat) { return RubyBoolean.newBoolean(context.runtime, (double) value == ((RubyFloat) other).getDoubleValue()); } return super.op_num_equal(context, other); }
/** fix_gt * */ @Override public IRubyObject op_gt(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) { return RubyBoolean.newBoolean(context.runtime, value > ((RubyFixnum) other).value); } return op_gtOther(context, other); }
/** fix_ge * */ @Override public IRubyObject op_ge(ThreadContext context, IRubyObject other) { if (other instanceof RubyFixnum) { return RubyBoolean.newBoolean(context.runtime, value >= ((RubyFixnum) other).value); } return op_geOther(context, other); }
public IRubyObject convert(Ruby runtime, Object object) { if (object == null) return runtime.getNil(); return RubyBoolean.newBoolean(runtime, ((Boolean)object).booleanValue()); } public IRubyObject get(Ruby runtime, Object array, int i) {
public IRubyObject convert(Ruby runtime, Object object) { if (object == null) return runtime.getNil(); return RubyBoolean.newBoolean(runtime, ((Boolean)object).booleanValue()); } public IRubyObject get(Ruby runtime, Object array, int i) {
private IRubyObject op_leOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return RubyBoolean.newBoolean(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum) other).value) <= 0); } if (other instanceof RubyFloat) { return RubyBoolean.newBoolean(context.runtime, (double) value <= ((RubyFloat) other).getDoubleValue()); } return coerceRelOp(context, sites(context).op_le, other); }
private IRubyObject op_gtOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return RubyBoolean.newBoolean(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum) other).value) > 0); } if (other instanceof RubyFloat) { return RubyBoolean.newBoolean(context.runtime, (double) value > ((RubyFloat) other).getDoubleValue()); } return coerceRelOp(context, sites(context).op_gt, other); }
private IRubyObject op_geOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return RubyBoolean.newBoolean(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum) other).value) >= 0); } if (other instanceof RubyFloat) { return RubyBoolean.newBoolean(context.runtime, (double) value >= ((RubyFloat) other).getDoubleValue()); } return coerceRelOp(context, sites(context).op_ge, other); }
private IRubyObject op_ltOther(ThreadContext context, IRubyObject other) { if (other instanceof RubyBignum) { return RubyBoolean.newBoolean(context.runtime, BigInteger.valueOf(value).compareTo(((RubyBignum) other).value) < 0); } if (other instanceof RubyFloat) { return RubyBoolean.newBoolean(context.runtime, (double) value < ((RubyFloat) other).getDoubleValue()); } return coerceRelOp(context, sites(context).op_lt, other); }
/** flo_is_nan_p * */ @JRubyMethod(name = "nan?") public IRubyObject nan_p() { return RubyBoolean.newBoolean(getRuntime(), isNaN()); }
/** * This method returns whether or not the encapsulated DataBag is empty. * * @param context the context the method is being executed in i @return true if the encapsulated DAtaBag is empty, false otherwise */ @JRubyMethod(name = "empty?") public RubyBoolean isEmpty(ThreadContext context) { return RubyBoolean.newBoolean(context.getRuntime(), internalDB.size() == 0); }
@JRubyMethod(name = { "objectspace", "object_space?" }, alias = { "objectspace?" }, module = true) public static IRubyObject getObjectSpaceEnabled(IRubyObject recv) { final Ruby runtime = recv.getRuntime(); return RubyBoolean.newBoolean(runtime, runtime.isObjectSpaceEnabled()); }
@JRubyMethod(name = "security_restricted?", module = true) public static RubyBoolean is_security_restricted(IRubyObject recv) { final Ruby runtime = recv.getRuntime(); return RubyBoolean.newBoolean(runtime, Ruby.isSecurityRestricted()); }
@JRubyMethod(name = "closed?") public static IRubyObject closed_p(ThreadContext context, IRubyObject recv) { ArgsFileData data = ArgsFileData.getArgsFileData(context.runtime); data.next_argv(context); return RubyBoolean.newBoolean(context.runtime, isClosed(context, data.currentFile)); }
@JRubyMethod(name = "<=", required = 1) public IRubyObject op_le(ThreadContext context, IRubyObject other) { final RubyHash otherHash = other.convertToHash(); if (size() > otherHash.size()) return context.fals; return RubyBoolean.newBoolean(context.runtime, hash_le(otherHash)); }
/** cmp_ge * */ @JRubyMethod(name = ">=", required = 1) public static RubyBoolean op_ge(ThreadContext context, IRubyObject recv, IRubyObject other) { IRubyObject result = sites(context).op_cmp.call(context, recv, recv, other); if (result.isNil()) cmperr(recv, other); return RubyBoolean.newBoolean(context.runtime, cmpint(context, result, recv, other) >= 0); }
/** cmp_le * */ @JRubyMethod(name = "<=", required = 1) public static RubyBoolean op_le(ThreadContext context, IRubyObject recv, IRubyObject other) { IRubyObject result = sites(context).op_cmp.call(context, recv, recv, other); if (result.isNil()) cmperr(recv, other); return RubyBoolean.newBoolean(context.runtime, cmpint(context, result, recv, other) <= 0); }
/** cmp_lt * */ @JRubyMethod(name = "<", required = 1) public static RubyBoolean op_lt(ThreadContext context, IRubyObject recv, IRubyObject other) { IRubyObject result = sites(context).op_cmp.call(context, recv, recv, other); if (result.isNil()) cmperr(recv, other); return RubyBoolean.newBoolean(context.runtime, cmpint(context, result, recv, other) < 0); }
@Override public Title getStructuredDoctitle() { Ruby runtime = getRubyObject().getRuntime(); RubyHash options = RubyHash.newHash(runtime); RubySymbol partitioned = RubySymbol.newSymbol(runtime, "partition"); options.put(partitioned, RubyBoolean.newBoolean(runtime, true)); Object doctitle = getRubyProperty("doctitle", options); return toJava((IRubyObject) doctitle, Title.class); }