internal static object DumpAll(RubyContext /*!*/ context, [NotNull] IEnumerable objs, [Optional] RubyIO io) { TextWriter writer; if (io != null) { writer = new RubyIOWriter(io); } else { writer = new MutableStringWriter(); } YamlOptions cfg = YamlOptions.DefaultOptions; using (Serializer s = new Serializer(new Emitter(writer, cfg), cfg)) { RubyRepresenter r = new RubyRepresenter(context, s, cfg); foreach (object obj in objs) { r.Represent(obj); } } if (null != io) { return(io); } else { return(((MutableStringWriter)writer).String); } }
internal static object DumpAll(RubyRepresenter /*!*/ rep, IEnumerable /*!*/ objs, RubyIO io) { TextWriter writer; if (io != null) { writer = new RubyIOWriter(io); } else { // the output is ascii: writer = new MutableStringWriter(MutableString.CreateMutable(RubyEncoding.Binary)); } YamlOptions cfg = YamlOptions.DefaultOptions; Serializer s = new Serializer(writer, cfg); foreach (object obj in objs) { s.Serialize(rep.Represent(obj)); rep.ForgetObjects(); } s.Close(); if (io != null) { return(io); } else { return(((MutableStringWriter)writer).String); } }
internal static object DumpAll(RubyRepresenter/*!*/ rep, IEnumerable/*!*/ objs, RubyIO io) { TextWriter writer; if (io != null) { writer = new RubyIOWriter(io); } else { // the output is ascii: writer = new MutableStringWriter(MutableString.CreateMutable(RubyEncoding.Binary)); } YamlOptions cfg = YamlOptions.DefaultOptions; Serializer s = new Serializer(writer, cfg); foreach (object obj in objs) { s.Serialize(rep.Represent(obj)); rep.ForgetObjects(); } s.Close(); if (io != null) { return io; } else { return ((MutableStringWriter)writer).String; } }
internal static object DumpAll(RubyContext/*!*/ context, [NotNull]IEnumerable objs, [Optional]RubyIO io) { TextWriter writer; if (io != null) { writer = new RubyIOWriter(io); } else { writer = new MutableStringWriter(); } YamlOptions cfg = YamlOptions.DefaultOptions; using (Serializer s = new Serializer(new Emitter(writer, cfg), cfg)) { RubyRepresenter r = new RubyRepresenter(context, s, cfg); foreach (object obj in objs) { r.Represent(obj); } } if (null != io) { return io; } else { return ((MutableStringWriter)writer).String; } }