class
KYAML::Builder
Overview
Imperative builder for KYAML output.
Constructs a KYAML::Any tree from #mapping / #sequence / #scalar / #field calls, then renders it through the Emitter so output is equivalent to KYAML.emit.
The tree is a per-collection buffer to allow cuddling to see every child of a collection before choosing the layout.
Defined in:
kyaml/builder.crConstructors
Instance Method Summary
-
#commit : Nil
Renders the built tree to the IO.
-
#document(&) : Nil
Wraps the built root value as a doc (
---header + trailing newline). -
#field(key : String, value) : Nil
Adds a key / scalar-value pair to the current mapping.
-
#field(key : String, &) : Nil
Adds a key whose value is a nested collection built by the block.
-
#mapping(&) : Nil
Builds a mapping in the current context.
-
#scalar(value) : Nil
Adds a scalar value to the current sequence.
-
#sequence(&) : Nil
Builds a sequence in the current context.
Instance methods inherited from class Reference
==(other : KYAML::Any)
==
Instance methods inherited from class Object
to_kyaml(io : IO) : Nilto_kyaml(builder : KYAML::Builder) : Nil
to_kyaml : String to_kyaml
Constructor Detail
Instance Method Detail
def field(key : String, &) : Nil
#
Adds a key whose value is a nested collection built by the block.