private static void catUTF8(final Ruby runtime, final RubyString str, final String value) { EncodingUtils.encStrBufCat(runtime, str, value); }
private static void catUTF8(final Ruby runtime, final RubyString str, final String value) { EncodingUtils.encStrBufCat(runtime, str, value); }
public final IRubyObject hashyInspect() { final Ruby runtime = getRuntime(); ByteList name = types(runtime, getMetaClass().getRealClass()).getByteList(); RubyString part = RubyString.newStringLight(runtime, 2 + name.length() + 3 + 8 + 1); // #<Object:0x5a1c0542> encStrBufCat(runtime, part, INSPECT_POUND_LT); encStrBufCat(runtime, part, name); encStrBufCat(runtime, part, INSPECT_COLON_ZERO_X); encStrBufCat(runtime, part, ConvertBytes.longToHexBytes(inspectHashCode())); if (runtime.isInspecting(this)) { encStrBufCat(runtime, part, INSPECT_SPACE_DOT_DOT_DOT_GT); return part; } try { runtime.registerInspecting(this); return inspectObj(runtime, part); } finally { runtime.unregisterInspecting(this); } }
public final IRubyObject hashyInspect() { final Ruby runtime = getRuntime(); ByteList name = types(runtime, getMetaClass().getRealClass()).getByteList(); RubyString part = RubyString.newStringLight(runtime, 2 + name.length() + 3 + 8 + 1); // #<Object:0x5a1c0542> encStrBufCat(runtime, part, INSPECT_POUND_LT); encStrBufCat(runtime, part, name); encStrBufCat(runtime, part, INSPECT_COLON_ZERO_X); encStrBufCat(runtime, part, ConvertBytes.longToHexBytes(inspectHashCode())); if (runtime.isInspecting(this)) { encStrBufCat(runtime, part, INSPECT_SPACE_DOT_DOT_DOT_GT); return part; } try { runtime.registerInspecting(this); return inspectObj(runtime, part); } finally { runtime.unregisterInspecting(this); } }
/** inspect_obj * * The internal helper method that takes care of the part of the * inspection that inspects instance variables. */ private RubyString inspectObj(final Ruby runtime, RubyString part) { final ThreadContext context = runtime.getCurrentContext(); boolean first = true; for (Map.Entry<String, VariableAccessor> entry : metaClass.getVariableTableManager().getVariableAccessorsForRead().entrySet()) { Object value = entry.getValue().get(this); RubySymbol symbol = runtime.newSymbol(entry.getKey()); if (!(value instanceof IRubyObject) || !symbol.validInstanceVariableName()) continue; IRubyObject obj = (IRubyObject) value; if (!first) encStrBufCat(runtime, part, INSPECT_COMMA); encStrBufCat(runtime, part, INSPECT_SPACE); // FIXME: bytelist_love: EPICLY wrong but something in MRI gets around identifiers of arbitrary encoding. encStrBufCat(runtime, part, symbol.asString().encode(context, runtime.getEncodingService().convertEncodingToRubyEncoding(part.getEncoding())).asString().getByteList()); encStrBufCat(runtime, part, INSPECT_EQUALS); encStrBufCat(runtime, part, sites(context).inspect.call(context, obj, obj).convertToString().getByteList()); first = false; } encStrBufCat(runtime, part, INSPECT_GT); return part; }
/** inspect_obj * * The internal helper method that takes care of the part of the * inspection that inspects instance variables. */ private RubyString inspectObj(final Ruby runtime, RubyString part) { final ThreadContext context = runtime.getCurrentContext(); boolean first = true; for (Map.Entry<String, VariableAccessor> entry : metaClass.getVariableTableManager().getVariableAccessorsForRead().entrySet()) { Object value = entry.getValue().get(this); RubySymbol symbol = runtime.newSymbol(entry.getKey()); if (!(value instanceof IRubyObject) || !symbol.validInstanceVariableName()) continue; IRubyObject obj = (IRubyObject) value; if (!first) encStrBufCat(runtime, part, INSPECT_COMMA); encStrBufCat(runtime, part, INSPECT_SPACE); // FIXME: bytelist_love: EPICLY wrong but something in MRI gets around identifiers of arbitrary encoding. encStrBufCat(runtime, part, symbol.asString().encode(context, runtime.getEncodingService().convertEncodingToRubyEncoding(part.getEncoding())).asString().getByteList()); encStrBufCat(runtime, part, INSPECT_EQUALS); encStrBufCat(runtime, part, sites(context).inspect.call(context, obj, obj).convertToString().getByteList()); first = false; } encStrBufCat(runtime, part, INSPECT_GT); return part; }
EncodingUtils.encStrBufCat(runtime, val, sBytes, p, ss - p, strEnc); EncodingUtils.encStrBufCat(runtime, val, sBytes, ss, s - ss, strEnc); p = s; continue; EncodingUtils.encStrBufCat(runtime, val, sBytes, ss, s - ss, strEnc); continue; case '0': case '&': break; case '`': EncodingUtils.encStrBufCat(runtime, val, srcbs.getUnsafeBytes(), srcbs.getBegin(), begin, srcEnc); continue; case '\'': EncodingUtils.encStrBufCat(runtime, val, srcbs.getUnsafeBytes(), srcbs.getBegin() + end, srcbs.getRealSize() - end, srcEnc); continue; case '+': break; case '\\': EncodingUtils.encStrBufCat(runtime, val, sBytes, s - clen[0], clen[0], strEnc); continue; default: EncodingUtils.encStrBufCat(runtime, val, sBytes, ss, s - ss, strEnc); continue; if (no >= regs.numRegs) continue; if (regs.beg[no] == -1) continue;
EncodingUtils.encStrBufCat(runtime, val, sBytes, p, ss - p, strEnc); EncodingUtils.encStrBufCat(runtime, val, sBytes, ss, s - ss, strEnc); p = s; continue; EncodingUtils.encStrBufCat(runtime, val, sBytes, ss, s - ss, strEnc); continue; case '0': case '&': break; case '`': EncodingUtils.encStrBufCat(runtime, val, srcbs.getUnsafeBytes(), srcbs.getBegin(), begin, srcEnc); continue; case '\'': EncodingUtils.encStrBufCat(runtime, val, srcbs.getUnsafeBytes(), srcbs.getBegin() + end, srcbs.getRealSize() - end, srcEnc); continue; case '+': break; case '\\': EncodingUtils.encStrBufCat(runtime, val, sBytes, s - clen[0], clen[0], strEnc); continue; default: EncodingUtils.encStrBufCat(runtime, val, sBytes, ss, s - ss, strEnc); continue; if (no >= regs.numRegs) continue; if (regs.beg[no] == -1) continue;
EncodingUtils.encStrBufCat(runtime, ptr.string, strByteList, enc); } else { strioExtend(ptr.pos, len);
EncodingUtils.encStrBufCat(runtime, ptr.string, strByteList, enc); } else { strioExtend(ptr.pos, len);
EncodingUtils.encStrBufCat(runtime, ptr.string, str.getByteList(), enc); } else { strioExtend(ptr.pos, len);
EncodingUtils.encStrBufCat(runtime, ptr.string, str.getByteList(), enc); } else { strioExtend(ptr.pos, len);