@Deprecated public static RubyInteger byteListToInum19(Ruby runtime, ByteList str, int base, boolean badcheck) { return byteListToInum(runtime, str, base, badcheck); }
@Deprecated public static RubyInteger byteListToInum19(Ruby runtime, ByteList str, int base, boolean badcheck) { return byteListToInum(runtime, str, base, badcheck); }
/** rb_cstr_to_inum * */ public static RubyInteger byteListToInum(Ruby runtime, ByteList str, int base, boolean badcheck) { return new ConvertBytes(runtime, str, base, badcheck).byteListToInum(); }
/** rb_cstr_to_inum * */ public static RubyInteger byteListToInum(Ruby runtime, ByteList str, int base, boolean badcheck) { return new ConvertBytes(runtime, str, base, badcheck).byteListToInum(); }
/** rb_str_to_inum * */ public IRubyObject stringToInum(int base, boolean badcheck) { ByteList s = this.value; return ConvertBytes.byteListToInum(getRuntime(), s, base, badcheck); }
/** rb_cstr_to_inum * */ public static RubyInteger byteListToInum(Ruby runtime, ByteList str, int base, boolean badcheck) { return new ConvertBytes(runtime, str, base, badcheck).byteListToInum(); }
/** rb_str_to_inum * */ public IRubyObject stringToInum(int base, boolean badcheck) { ByteList s = this.value; return ConvertBytes.byteListToInum(getRuntime(), s, base, badcheck); }
/** rb_cstr_to_inum * */ public static RubyInteger byteListToInum(Ruby runtime, ByteList str, int base, boolean badcheck) { return new ConvertBytes(runtime, str, base, badcheck).byteListToInum(); }
public static RubyInteger byteListToInum(Ruby runtime, ByteList str, int off, int end, int base, boolean badcheck) { return new ConvertBytes(runtime, str, off, end, base, badcheck).byteListToInum(); }
public static RubyInteger byteListToInum19(Ruby runtime, ByteList str, int base, boolean badcheck) { return new ConvertBytes(runtime, str, base, badcheck, true).byteListToInum(); }
public static RubyInteger byteListToInum19(Ruby runtime, ByteList str, int base, boolean badcheck) { return new ConvertBytes(runtime, str, base, badcheck, true).byteListToInum(); }
public static RubyInteger byteListToInum(Ruby runtime, ByteList str, int off, int end, int base, boolean badcheck) { return new ConvertBytes(runtime, str, off, end, base, badcheck).byteListToInum(); }
return ConvertBytes.byteListToInum(runtime, s, base, strict);
return ConvertBytes.byteListToInum(runtime, s, base, strict);
private static RubyInteger cstr2num(Ruby runtime, RubyString str, int bp, int ep) { if (bp == ep) return RubyFixnum.zero(runtime); return ConvertBytes.byteListToInum(runtime, str.getByteList(), bp, ep, 10, true); }
private static RubyInteger cstr2num(Ruby runtime, RubyString str, int bp, int ep) { if (bp == ep) return RubyFixnum.zero(runtime); return ConvertBytes.byteListToInum(runtime, str.getByteList(), bp, ep, 10, true); }
/** rb_str_to_inum * */ public IRubyObject stringToInum(int base, boolean badcheck) { final ByteList str = this.value; if (!str.getEncoding().isAsciiCompatible()) { throw getRuntime().newEncodingCompatibilityError("ASCII incompatible encoding: " + str.getEncoding()); } return ConvertBytes.byteListToInum(getRuntime(), str, base, badcheck); }
/** rb_str_to_inum * */ public IRubyObject stringToInum(int base, boolean badcheck) { final ByteList str = this.value; if (!str.getEncoding().isAsciiCompatible()) { throw getRuntime().newEncodingCompatibilityError("ASCII incompatible encoding: " + str.getEncoding()); } return ConvertBytes.byteListToInum(getRuntime(), str, base, badcheck); }
static RubyFloat new_float(final Ruby runtime, IRubyObject object) { if (object instanceof RubyInteger){ return new_float(runtime, (RubyInteger) object); } if (object instanceof RubyFloat) { return (RubyFloat) object; } if (object instanceof RubyString){ RubyString str = (RubyString) object; ByteList bytes = str.getByteList(); if (bytes.getRealSize() == 0){ // rb_cstr_to_dbl case throw runtime.newArgumentError("invalid value for Float(): " + object.inspect()); } if (bytes.startsWith(ZEROx)) { // startsWith("0x") return ConvertBytes.byteListToInum(runtime, bytes, 16, true).toFloat(); } return RubyNumeric.str2fnum(runtime, str, true); } if (object.isNil()){ throw runtime.newTypeError("can't convert nil into Float"); } ThreadContext context = runtime.getCurrentContext(); KernelSites sites = sites(context); return (RubyFloat) TypeConverter.convertToType(context, object, runtime.getFloat(), sites.to_f_checked); }
static RubyFloat new_float(final Ruby runtime, IRubyObject object) { if (object instanceof RubyInteger){ return new_float(runtime, (RubyInteger) object); } if (object instanceof RubyFloat) { return (RubyFloat) object; } if (object instanceof RubyString){ RubyString str = (RubyString) object; ByteList bytes = str.getByteList(); if (bytes.getRealSize() == 0){ // rb_cstr_to_dbl case throw runtime.newArgumentError("invalid value for Float(): " + object.inspect()); } if (bytes.startsWith(ZEROx)) { // startsWith("0x") return ConvertBytes.byteListToInum(runtime, bytes, 16, true).toFloat(); } return RubyNumeric.str2fnum(runtime, str, true); } if (object.isNil()){ throw runtime.newTypeError("can't convert nil into Float"); } ThreadContext context = runtime.getCurrentContext(); KernelSites sites = sites(context); return (RubyFloat) TypeConverter.convertToType(context, object, runtime.getFloat(), sites.to_f_checked); }