private void WriteString(MutableString /*!*/ value) { SubclassData instanceWriter = new SubclassData(this, value, typeof(MutableString)); _writer.Write((byte)'"'); WriteStringValue(value); }
private void WriteRegex(RubyRegex /*!*/ value) { SubclassData instanceWriter = new SubclassData(this, value, typeof(RubyRegex)); _writer.Write((byte)'/'); WriteStringValue(value.GetPattern()); _writer.Write((byte)value.Options); }
private void WriteArray(RubyArray /*!*/ value) { SubclassData instanceWriter = new SubclassData(this, value, typeof(RubyArray)); _writer.Write((byte)'['); WriteInt32(value.Count); foreach (object obj in value) { WriteAnObject(obj); } }
private void WriteStruct(RubyStruct /*!*/ obj) { SubclassData instanceWriter = new SubclassData(this, obj, typeof(RubyStruct)); _writer.Write((byte)'S'); RubyClass theClass = _context.GetClassOf(obj); TestForAnonymous(theClass); WriteSymbol(theClass.Name); var names = obj.GetNames(); WriteInt32(names.Count); foreach (string name in names) { int index = obj.GetIndex(name); WriteSymbol(name); WriteAnObject(obj[index]); } }
private void WriteHash(Hash /*!*/ value) { if (value.DefaultProc != null) { throw RubyExceptions.CreateTypeError("can't dump hash with default proc"); } SubclassData instanceWriter = new SubclassData(this, value, typeof(Hash)); char typeFlag = (value.DefaultValue != null) ? '}' : '{'; _writer.Write((byte)typeFlag); WriteInt32(value.Count); foreach (KeyValuePair <object, object> pair in value) { WriteAnObject(pair.Key); WriteAnObject(pair.Value); } if (value.DefaultValue != null) { WriteAnObject(value.DefaultValue); } }
private void WriteStruct(RubyStruct/*!*/ obj) { SubclassData instanceWriter = new SubclassData(this, obj, typeof(RubyStruct)); _writer.Write((byte)'S'); RubyClass theClass = _context.GetClassOf(obj); TestForAnonymous(theClass); WriteSymbol(theClass.Name); var names = obj.GetNames(); WriteInt32(names.Count); foreach (string name in names) { int index = obj.GetIndex(name); WriteSymbol(name); WriteAnObject(obj[index]); } }
private void WriteHash(Hash/*!*/ value) { if (value.DefaultProc != null) { throw RubyExceptions.CreateTypeError("can't dump hash with default proc"); } SubclassData instanceWriter = new SubclassData(this, value, typeof(Hash)); char typeFlag = (value.DefaultValue != null) ? '}' : '{'; _writer.Write((byte)typeFlag); WriteInt32(value.Count); foreach (KeyValuePair<object, object> pair in value) { WriteAnObject(pair.Key); WriteAnObject(pair.Value); } if (value.DefaultValue != null) { WriteAnObject(value.DefaultValue); } }
private void WriteArray(RubyArray/*!*/ value) { SubclassData instanceWriter = new SubclassData(this, value, typeof(RubyArray)); _writer.Write((byte)'['); WriteInt32(value.Count); foreach (object obj in value) { WriteAnObject(obj); } }
private void WriteRegex(RubyRegex/*!*/ value) { SubclassData instanceWriter = new SubclassData(this, value, typeof(RubyRegex)); _writer.Write((byte)'/'); WriteStringValue(value.GetPattern()); _writer.Write((byte)value.Options); }
private void WriteString(MutableString/*!*/ value) { SubclassData instanceWriter = new SubclassData(this, value, typeof(MutableString)); _writer.Write((byte)'"'); WriteStringValue(value); }