public static RubyString types(Ruby runtime, RubyModule type1, RubyModule type2) { ThreadContext context = runtime.getCurrentContext(); RubyString fullTypeName = type1.toRubyString(context).catString("::").cat(type2.toRubyString(context)); return inspectIdentifierByteList(runtime, fullTypeName.getByteList()); }
public static RubyString types(Ruby runtime, RubyModule type1, RubyModule type2) { ThreadContext context = runtime.getCurrentContext(); RubyString fullTypeName = type1.toRubyString(context).catString("::").cat(type2.toRubyString(context)); return inspectIdentifierByteList(runtime, fullTypeName.getByteList()); }
/** inspect_hash * */ private IRubyObject inspectHash(final ThreadContext context) { final RubyString str = RubyString.newStringLight(context.runtime, DEFAULT_INSPECT_STR_SIZE, USASCIIEncoding.INSTANCE); str.infectBy(this); str.cat((byte)'{'); visitAll(context, InspectVisitor, str); str.cat((byte)'}'); return str; }
public RubyString append(RubyString otherStr) { modifyCheck(); infectBy(otherStr); return cat(otherStr.value); }
public void handle(Emitter emitter, byte[] str, int len) { YEmitter.Extra bonus = (YEmitter.Extra)emitter.bonus; IRubyObject dest = bonus.port; if(dest instanceof RubyString) { ((RubyString)dest).cat(new ByteList(str, 0, len, false)); } else { dest.callMethod(runtime.getCurrentContext(), "write", RubyString.newStringShared(runtime, str, 0, len)); } } }
private RubyString to_s(final Ruby runtime) { RubyString str = RubyString.newString(runtime, new ByteList(10), USASCIIEncoding.INSTANCE); str.append(num.to_s()); str.cat((byte)'/'); str.append(den.to_s()); return str; }
@JRubyMethod(name = "inspect") public IRubyObject inspect(ThreadContext context) { RubyString str = inspect(context, begin).strDup(context.runtime); RubyString str2 = inspect(context, end); str.cat(isExclusive ? DOTDOTDOT : DOTDOT); str.concat(str2); str.infectBy(str2); return str; }
private RubyString to_s(final Ruby runtime) { RubyString i1 = begin.asString().strDup(runtime); RubyString i2 = end.asString(); i1.cat(DOTDOTDOT, 0, isExclusive ? 3 : 2); i1.append(i2); i1.infectBy(i2); i1.infectBy(this); return i1; }
/** nurat_to_s * */ @JRubyMethod(name = "to_s") public IRubyObject to_s(ThreadContext context) { RubyString str = RubyString.newEmptyString(context.getRuntime()); str.append(f_to_s(context, num)); str.cat((byte)'/'); str.append(f_to_s(context, den)); return str; }
@JRubyMethod(name = "inspect") public RubyString inspect(final ThreadContext context) { RubyString i1 = inspectValue(context, begin).strDup(context.runtime); RubyString i2 = inspectValue(context, end); i1.cat(DOTDOTDOT, 0, isExclusive ? 3 : 2); i1.append(i2); i1.infectBy(i2); i1.infectBy(this); return i1; }
private IRubyObject inspect2() { if (pos >= str.getByteList().getRealSize()) return RubyString.newEmptyString(getRuntime()); int len = str.getByteList().getRealSize() - pos; if (len > INSPECT_LENGTH) { return ((RubyString)str.substr(getRuntime(), pos, INSPECT_LENGTH)).cat("...".getBytes()).inspect(); } else { return str.substr(getRuntime(), pos, len).inspect(); } }
private IRubyObject inspect2() { if (pos >= str.getByteList().getRealSize()) return RubyString.newEmptyString(getRuntime()); int len = str.getByteList().getRealSize() - pos; if (len > INSPECT_LENGTH) { return ((RubyString)str.substr(getRuntime(), pos, INSPECT_LENGTH)).cat("...".getBytes()).inspect(); } else { return str.substr(getRuntime(), pos, len).inspect(); } }
private IRubyObject inspect2() { final Ruby runtime = getRuntime(); if (pos >= str.getByteList().getRealSize()) return RubyString.newEmptyString(runtime); int len = str.getByteList().getRealSize() - pos; if (len > INSPECT_LENGTH) { return ((RubyString) str.substr(runtime, pos, INSPECT_LENGTH)).cat(DOT_BYTES).inspect(); } return str.substr(runtime, pos, len).inspect(); }