/** * @deprecated Use {@link #checkStringType()} instead. */ default IRubyObject checkStringType19() { return checkStringType(); }
/** * @deprecated Use {@link #checkStringType()} instead. */ default IRubyObject checkStringType19() { return checkStringType(); }
@JRubyMethod(meta = true) public static IRubyObject try_convert(ThreadContext context, IRubyObject recv, IRubyObject str) { return str.checkStringType(); }
private static IRubyObject regOperand(IRubyObject str, boolean check) { if (str instanceof RubySymbol) return ((RubySymbol) str).to_s(); return check ? str.convertToString() : str.checkStringType(); }
private static RubyString getStringForPattern(Ruby runtime, IRubyObject obj) { if (obj instanceof RubyString) return (RubyString) obj; IRubyObject val = obj.checkStringType(); if (val.isNil()) throw runtime.newTypeError("wrong argument type " + obj.getMetaClass() + " (expected Regexp)"); return (RubyString) val; }
private static RubyString getStringForPattern(Ruby runtime, IRubyObject obj) { if (obj instanceof RubyString) return (RubyString) obj; IRubyObject val = obj.checkStringType(); if (val.isNil()) throw runtime.newTypeError("wrong argument type " + obj.getMetaClass() + " (expected Regexp)"); return (RubyString) val; }
@JRubyMethod public static IRubyObject tagurize(IRubyObject self, IRubyObject val) { IRubyObject tmp = val.checkStringType(); if(!tmp.isNil()) { String taguri = ImplicitScanner.typeIdToUri(tmp.toString()); val = self.getRuntime().newString(taguri); } return val; } }
private static RubyString operandCheck(Ruby runtime, IRubyObject str) { if (str instanceof RubySymbol) return (RubyString)((RubySymbol)str).to_s(); IRubyObject tmp = str.checkStringType(); if (tmp.isNil()) throw runtime.newTypeError("can't convert " + str.getMetaClass() + " into String"); return (RubyString)tmp; }
private RubyString getStringForPattern(IRubyObject obj) { if (obj instanceof RubyString) return (RubyString)obj; IRubyObject val = obj.checkStringType(); if (val.isNil()) throw getRuntime().newTypeError("wrong argument type " + obj.getMetaClass() + " (expected Regexp)"); return (RubyString)val; }
private static RubyString operandCheck(Ruby runtime, IRubyObject str) { if (str instanceof RubySymbol) return (RubyString)((RubySymbol)str).to_s(); IRubyObject tmp = str.checkStringType(); if (tmp.isNil()) throw runtime.newTypeError("can't convert " + str.getMetaClass() + " into String"); return (RubyString)tmp; }
private RubyString getStringForPattern(IRubyObject obj) { if (obj instanceof RubyString) return (RubyString)obj; IRubyObject val = obj.checkStringType(); if (val.isNil()) throw getRuntime().newTypeError("wrong argument type " + obj.getMetaClass() + " (expected Regexp)"); return (RubyString)val; }
@JRubyMethod(name = "require", module = true, visibility = PRIVATE, compat = RUBY1_9) public static IRubyObject require19(ThreadContext context, IRubyObject recv, IRubyObject name, Block block) { Ruby runtime = context.runtime; IRubyObject tmp = name.checkStringType(); if (!tmp.isNil()) return requireCommon(runtime, recv, tmp, block); return requireCommon(runtime, recv, RubyFile.get_path(context, name), block); }
private boolean start_with_pCommon(IRubyObject arg) { IRubyObject tmp = arg.checkStringType(); if (tmp.isNil()) return false; RubyString otherString = (RubyString)tmp; checkEncoding(otherString); if (value.getRealSize() < otherString.value.getRealSize()) return false; return value.startsWith(otherString.value); }
private boolean start_with_pCommon(IRubyObject arg) { IRubyObject tmp = arg.checkStringType(); if (tmp.isNil()) return false; RubyString otherString = (RubyString)tmp; checkEncoding(otherString); if (value.getRealSize() < otherString.value.getRealSize()) return false; return value.startsWith(otherString.value); }
@JRubyMethod(name = "require", module = true, visibility = PRIVATE, compat = RUBY1_9) public static IRubyObject require19(ThreadContext context, IRubyObject recv, IRubyObject name, Block block) { Ruby runtime = context.runtime; IRubyObject tmp = name.checkStringType(); if (!tmp.isNil()) return requireCommon(runtime, recv, tmp, block); return requireCommon(runtime, recv, RubyFile.get_path(context, name), block); }
public static Encoding toEncodingIndex(ThreadContext context, IRubyObject enc) { if (enc instanceof RubyEncoding) { return ((RubyEncoding)enc).getEncoding(); } else if ((enc = enc.checkStringType()).isNil()) { return null; } if (!((RubyString)enc).getEncoding().isAsciiCompatible()) { return null; } return context.runtime.getEncodingService().getEncodingFromObjectNoError(enc); }
public static Encoding toEncodingIndex(ThreadContext context, IRubyObject enc) { if (enc instanceof RubyEncoding) { return ((RubyEncoding)enc).getEncoding(); } else if ((enc = enc.checkStringType()).isNil()) { return null; } if (!((RubyString)enc).getEncoding().isAsciiCompatible()) { return null; } return context.runtime.getEncodingService().getEncodingFromObjectNoError(enc); }
@JRubyMethod(name = "Integer", module = true, visibility = PRIVATE, compat = RUBY1_9) public static IRubyObject new_integer19(ThreadContext context, IRubyObject recv, IRubyObject object, IRubyObject base) { int bs = RubyNumeric.num2int(base); if(object instanceof RubyString) { return RubyNumeric.str2inum(context.runtime,(RubyString)object,bs,true); } else { IRubyObject tmp = object.checkStringType(); if(!tmp.isNil()) { return RubyNumeric.str2inum(context.runtime,(RubyString)tmp,bs,true); } } throw context.runtime.newArgumentError("base specified for non string value"); }
private static RubySymbol stringOrSymbol(IRubyObject obj) { if (obj instanceof RubySymbol) return (RubySymbol) obj; if (obj instanceof RubyString) return RubySymbol.newSymbol(obj.getRuntime(), obj.asJavaString().intern()); if (obj instanceof RubyFixnum) { obj.getRuntime().getWarnings().warn(ID.FIXNUMS_NOT_SYMBOLS, "do not use Fixnums as Symbols"); throw obj.getRuntime().newArgumentError("" + obj + " is not a symbol"); } IRubyObject strValue = obj.checkStringType(); if (!strValue.isNil()) return RubySymbol.newSymbol(obj.getRuntime(), obj.asJavaString().intern()); throw obj.getRuntime().newTypeError("" + obj + " is not a symbol"); }
private static RubySymbol stringOrSymbol(IRubyObject obj) { if (obj instanceof RubySymbol) return (RubySymbol) obj; if (obj instanceof RubyString) return RubySymbol.newSymbol(obj.getRuntime(), obj.asJavaString().intern()); if (obj instanceof RubyFixnum) { obj.getRuntime().getWarnings().warn(ID.FIXNUMS_NOT_SYMBOLS, "do not use Fixnums as Symbols"); throw obj.getRuntime().newArgumentError("" + obj + " is not a symbol"); } IRubyObject strValue = obj.checkStringType(); if (!strValue.isNil()) return RubySymbol.newSymbol(obj.getRuntime(), obj.asJavaString().intern()); throw obj.getRuntime().newTypeError("" + obj + " is not a symbol"); }