@Override protected String toString(RubySymbol obj) { return obj.toString(); }
@Override public String toString() { return isSelf() ? name.toString() : name + "(" + scopeDepth + ":" + offset + (isOuterScopeVar ? ":outer=true" : "") + ")"; }
@Override public String toString() { return isSelf() ? name.toString() : name + "(" + scopeDepth + ":" + offset + (isOuterScopeVar ? ":outer=true" : "") + ")"; }
/** * Properly stringify an object for the current "raw bytes" representation * of a symbol. * * Symbols are represented internally as a Java string, but decoded using * raw bytes in ISO-8859-1 representation. This means they do not in their * normal String form represent a readable Java string, but it does allow * differently-encoded strings to map to different symbol objects. * * See #736 * * @param object the object to symbolify * @return the symbol string associated with the object's string representation */ public static String objectToSymbolString(IRubyObject object) { if (object instanceof RubySymbol) { return ((RubySymbol)object).toString(); } else if (object instanceof RubyString) { return ((RubyString)object).getByteList().toString(); } else { return object.convertToString().getByteList().toString(); } } }
/** * Properly stringify an object for the current "raw bytes" representation * of a symbol. * * Symbols are represented internally as a Java string, but decoded using * raw bytes in ISO-8859-1 representation. This means they do not in their * normal String form represent a readable Java string, but it does allow * differently-encoded strings to map to different symbol objects. * * See #736 * * @param object the object to symbolify * @return the symbol string associated with the object's string representation */ public static String objectToSymbolString(IRubyObject object) { if (object instanceof RubySymbol) { return ((RubySymbol)object).toString(); } else if (object instanceof RubyString) { return ((RubyString)object).getByteList().toString(); } else { return object.convertToString().getByteList().toString(); } } }
private IRubyObject defaultObjectUnmarshal() throws IOException { RubySymbol className = (RubySymbol) unmarshalObject(false); RubyClass type = null; try { type = getClassFromPath(runtime, className.toString()); } catch (RaiseException e) { if (runtime.getModule("NameError").isInstance(e.getException())) { throw runtime.newArgumentError("undefined class/module " + className.asJavaString()); } throw e; } assert type != null : "type shouldn't be null."; IRubyObject result = (IRubyObject)type.unmarshal(this); return result; }
private IRubyObject defaultObjectUnmarshal() throws IOException { RubySymbol className = (RubySymbol) unmarshalObject(false); RubyClass type = null; try { type = getClassFromPath(runtime, className.toString()); } catch (RaiseException e) { if (runtime.getModule("NameError").isInstance(e.getException())) { throw runtime.newArgumentError("undefined class/module " + className.asJavaString()); } throw e; } assert type != null : "type shouldn't be null."; IRubyObject result = (IRubyObject)type.unmarshal(this); return result; }