/** Create a new String which uses the same Ruby runtime and the same * class like this String. * * This method should be used to satisfy RCR #38. * @deprecated */ @Deprecated public RubyString newString(ByteList s) { return new RubyString(getRuntime(), getMetaClass(), s); }
/** Create a new String which uses the same Ruby runtime and the same * class like this String. * * This method should be used to satisfy RCR #38. * @deprecated */ @Deprecated public RubyString newString(ByteList s) { return new RubyString(getRuntime(), getMetaClass(), s); }
/** Create a new String which uses the same Ruby runtime and the same * class like this String. * * This method should be used to satisfy RCR #38. * @deprecated */ @Deprecated public RubyString newString(ByteList s) { return new RubyString(getRuntime(), getMetaClass(), s); }
/** rb_str_dup * */ @Deprecated public final RubyString strDup() { return strDup(getRuntime(), getMetaClass()); }
/** rb_str_dup * */ @Deprecated public final RubyString strDup() { return strDup(getRuntime(), getMetaClass()); }
/** short circuit for String key comparison * */ @Override public final boolean eql(IRubyObject other) { RubyClass metaclass = getMetaClass(); Ruby runtime = metaclass.getClassRuntime(); if (metaclass != runtime.getString() || metaclass != other.getMetaClass()) return super.eql(other); return eql19(other); }
/** short circuit for String key comparison * */ @Override public final boolean eql(IRubyObject other) { RubyClass metaclass = getMetaClass(); Ruby runtime = metaclass.getClassRuntime(); if (metaclass != runtime.getString() || metaclass != other.getMetaClass()) return super.eql(other); return eql19(other); }
@JRubyMethod(name = {"to_s", "to_str"}) @Override public IRubyObject to_s() { Ruby runtime = getRuntime(); if (getMetaClass().getRealClass() != runtime.getString()) { return strDup(runtime, runtime.getString()); } return this; }
/** rb_str_chop / rb_str_chop_bang * */ @JRubyMethod(name = "chop", compat = RUBY1_8) public IRubyObject chop(ThreadContext context) { if (value.getRealSize() == 0) return newEmptyString(context.runtime, getMetaClass()).infectBy(this); return makeShared(context.runtime, 0, choppedLength()); }
public RubyString newFrozen() { if (isFrozen()) return this; RubyClass klass = getMetaClass(); RubyString str = strDup(klass.getClassRuntime()); str.setCodeRange(getCodeRange()); str.setFrozen(true); return str; }
@JRubyMethod(name = {"to_s", "to_str"}) @Override public IRubyObject to_s() { Ruby runtime = getRuntime(); if (getMetaClass().getRealClass() != runtime.getString()) { return strDup(runtime, runtime.getString()); } return this; }
@JRubyMethod(name = {"to_s", "to_str"}) @Override public IRubyObject to_s() { Ruby runtime = getRuntime(); if (getMetaClass().getRealClass() != runtime.getString()) { return strDup(runtime, runtime.getString()); } return this; }
public RubyString newFrozen() { if (isFrozen()) return this; RubyClass klass = getMetaClass(); RubyString str = strDup(klass.getClassRuntime()); str.setCodeRange(getCodeRange()); str.setFrozen(true); return str; }
@JRubyMethod(name = {"to_s", "to_str"}) @Override public IRubyObject to_s() { Ruby runtime = getRuntime(); if (getMetaClass().getRealClass() != runtime.getString()) { return strDup(runtime, runtime.getString()); } return this; }
@JRubyMethod(name = "chop") public IRubyObject chop(ThreadContext context) { Ruby runtime = context.runtime; if (value.getRealSize() == 0) return newEmptyString(runtime, getMetaClass(), value.getEncoding()).infectBy(this); return makeShared(runtime, 0, StringSupport.choppedLength(this)); }
@JRubyMethod(name = "chop", compat = RUBY1_9) public IRubyObject chop19(ThreadContext context) { Ruby runtime = context.runtime; if (value.getRealSize() == 0) return newEmptyString(runtime, getMetaClass(), value.getEncoding()).infectBy(this); return makeShared19(runtime, 0, choppedLength19(runtime)); }
/** short circuit for String key comparison * */ @Override public final boolean eql(IRubyObject other) { RubyClass metaclass = getMetaClass(); Ruby runtime = metaclass.getClassRuntime(); if (metaclass != runtime.getString() || metaclass != other.getMetaClass()) return super.eql(other); return runtime.is1_9() ? eql19(runtime, other) : eql18(runtime, other); }
/** short circuit for String key comparison * */ @Override public final boolean eql(IRubyObject other) { RubyClass metaclass = getMetaClass(); Ruby runtime = metaclass.getClassRuntime(); if (metaclass != runtime.getString() || metaclass != other.getMetaClass()) return super.eql(other); return runtime.is1_9() ? eql19(runtime, other) : eql18(runtime, other); }
@JRubyMethod(name = {"succ", "next"}) public IRubyObject succ(ThreadContext context) { Ruby runtime = context.runtime; final RubyString str; if (value.getRealSize() > 0) { str = new RubyString(runtime, getMetaClass(), StringSupport.succCommon(runtime, value)); // TODO: rescan code range ? } else { str = newEmptyString(runtime, getType(), value.getEncoding()); } return str.infectBy(this); }
@JRubyMethod(name = {"succ", "next"}, compat = RUBY1_9) public IRubyObject succ19(ThreadContext context) { Ruby runtime = context.runtime; final RubyString str; if (value.getRealSize() > 0) { str = new RubyString(runtime, getMetaClass(), succCommon19(value)); // TODO: rescan code range ? } else { str = newEmptyString(runtime, getType(), value.getEncoding()); } return str.infectBy(this); }