Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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;
            }
        }