/** * A type specific conversion routine. * * @param rbObject object to convert * @return analogous Pig type */ public static Long rubyToPig(RubyBignum rbObject) { return rbObject.getLongValue(); }
@JRubyMethod(name = {"concat", "<<"}, compat = RUBY1_9) public RubyString concat19(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other instanceof RubyFixnum) { int c = RubyNumeric.num2int(other); if (c < 0) { throw runtime.newRangeError("negative string size (or size too big)"); } return concatNumeric(runtime, c); } else if (other instanceof RubyBignum) { if (((RubyBignum) other).getBigIntegerValue().signum() < 0) { throw runtime.newRangeError("negative string size (or size too big)"); } long c = ((RubyBignum) other).getLongValue(); return concatNumeric(runtime, (int) c); } if (other instanceof RubySymbol) throw runtime.newTypeError("can't convert Symbol into String"); return append19(other); }
/** rb_str_concat * */ @JRubyMethod(name = "<<") public RubyString concatSingle(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other instanceof RubyFixnum) { long c = RubyNumeric.num2long(other); if (c < 0) { throw runtime.newRangeError(c + " out of char range"); } return concatNumeric(runtime, (int)(c & 0xFFFFFFFF)); } else if (other instanceof RubyBignum) { if (((RubyBignum) other).getBigIntegerValue().signum() < 0) { throw runtime.newRangeError("negative string size (or size too big)"); } long c = ((RubyBignum) other).getLongValue(); return concatNumeric(runtime, (int) c); } if (other instanceof RubySymbol) throw runtime.newTypeError("can't convert Symbol into String"); return append19(other); }
@JRubyMethod(name = {"concat", "<<"}, compat = RUBY1_9) public RubyString concat19(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other instanceof RubyFixnum) { int c = RubyNumeric.num2int(other); if (c < 0) { throw runtime.newRangeError("negative string size (or size too big)"); } return concatNumeric(runtime, c); } else if (other instanceof RubyBignum) { if (((RubyBignum) other).getBigIntegerValue().signum() < 0) { throw runtime.newRangeError("negative string size (or size too big)"); } long c = ((RubyBignum) other).getLongValue(); return concatNumeric(runtime, (int) c); } if (other instanceof RubySymbol) throw runtime.newTypeError("can't convert Symbol into String"); return append19(other); }
/** rb_str_concat * */ @JRubyMethod(name = "<<") public RubyString concatSingle(ThreadContext context, IRubyObject other) { Ruby runtime = context.runtime; if (other instanceof RubyFixnum) { long c = RubyNumeric.num2long(other); if (c < 0) { throw runtime.newRangeError(c + " out of char range"); } return concatNumeric(runtime, (int)(c & 0xFFFFFFFF)); } else if (other instanceof RubyBignum) { if (((RubyBignum) other).getBigIntegerValue().signum() < 0) { throw runtime.newRangeError("negative string size (or size too big)"); } long c = ((RubyBignum) other).getLongValue(); return concatNumeric(runtime, (int) c); } if (other instanceof RubySymbol) throw runtime.newTypeError("can't convert Symbol into String"); return append19(other); }