Inheritance: NodeProvider
Exemple #1
0
        private static object ParseObject(RubyConstructor /*!*/ ctor, string /*!*/ value)
        {
            Composer composer = RubyYaml.MakeComposer(new StringReader(value), ctor.Encoding);

            if (composer.CheckNode())
            {
                return(ctor.ConstructObject(composer.GetNode()));
            }
            else
            {
                throw new ConstructorException("Invalid YAML element: " + value);
            }
        }
Exemple #2
0
        public static object ParseDocuments(BlockParam block, RubyModule self, object io)
        {
            Composer c = MakeComposer(CheckYamlPort(io));

            if (block == null && c.CheckNode())
            {
                throw RubyExceptions.NoBlockGiven();
            }
            foreach (object obj in c)
            {
                object result;
                if (block.Yield(obj, out result))
                {
                    return(result);
                }
            }
            return(null);
        }