A disabled default is present on this object. To use it, use one of the other constructors or a factory function.
Construct a Dumper writing to a file.
Construct a Dumper writing to a _stream. This is useful to e.g. write to memory.
Destroy the Dumper.
Dump one or more YAML _documents to the file/stream.
Specify YAML version string. "1.1" by default.
Write scalars in canonical form?
Set character encoding to use. UTF-8 by default.
Always explicitly write document end?
Always explicitly write document start?
Set indentation width. 2 by default. Must not be zero.
Set line break to use. Unix by default.
Set stream name. Used in debugging messages.
Specify custom Representer to use.
Specify custom Resolver to use.
Specify tag directives.
Set preferred text _width.
Write to a file:
auto node = Node([1, 2, 3, 4, 5]); Dumper("file.yaml").dump(node);
Write multiple YAML documents to a file:
1 auto node1 = Node([1, 2, 3, 4, 5]); 2 auto node2 = Node("This document contains only one string"); 3 Dumper("file.yaml").dump(node1, node2); 4 5 //Or with an array: 6 //Dumper("file.yaml").dump([node1, node2]);
Write to memory:
import std.stream; auto stream = new YMemoryStream(); auto node = Node([1, 2, 3, 4, 5]); Dumper(stream).dump(node);
Use a custom representer/resolver to support custom data types and/or implicit tags:
1 auto node = Node([1, 2, 3, 4, 5]); 2 auto representer = new Representer(); 3 auto resolver = new Resolver(); 4 5 //Add representer functions / resolver expressions here... 6 7 auto dumper = Dumper("file.yaml"); 8 dumper.representer = representer; 9 dumper.resolver = resolver; 10 dumper.dump(node);
Dumps YAML documents to files or streams.
User specified Representer and/or Resolver can be used to support new tags / data types.
Setters are provided to affect output details (style, encoding, etc.).