Updated Loader examples.
This commit is contained in:
parent
626337f6ed
commit
e100047572
|
@ -55,17 +55,15 @@ import dyaml.token;
|
|||
///
|
||||
/// Load YAML from memory:
|
||||
/// --------------------
|
||||
/// import std.stream;
|
||||
/// import std.stdio;
|
||||
///
|
||||
/// string yaml_input = "red: '#ff0000'\n"
|
||||
/// char[] yaml_input = "red: '#ff0000'\n"
|
||||
/// "green: '#00ff00'\n"
|
||||
/// "blue: '#0000ff'";
|
||||
/// "blue: '#0000ff'".dup;
|
||||
///
|
||||
/// auto colors = Loader.fromString(yaml_input).load();
|
||||
///
|
||||
/// foreach(string color, string value; colors)
|
||||
/// {
|
||||
/// import std.stdio;
|
||||
/// writeln(color, " is ", value, " in HTML/CSS");
|
||||
/// }
|
||||
/// --------------------
|
||||
|
@ -75,7 +73,7 @@ import dyaml.token;
|
|||
/// auto constructor = new Constructor();
|
||||
/// auto resolver = new Resolver();
|
||||
///
|
||||
/// //Add constructor functions / resolver expressions here...
|
||||
/// // Add constructor functions / resolver expressions here...
|
||||
///
|
||||
/// auto loader = Loader("file.yaml");
|
||||
/// loader.constructor = constructor;
|
||||
|
@ -360,11 +358,11 @@ struct Loader
|
|||
|
||||
unittest
|
||||
{
|
||||
string yaml_input = "red: '#ff0000'\n"
|
||||
char[] yaml_input = "red: '#ff0000'\n"
|
||||
"green: '#00ff00'\n"
|
||||
"blue: '#0000ff'";
|
||||
"blue: '#0000ff'".dup;
|
||||
|
||||
auto colors = Loader(cast(void[])yaml_input).load();
|
||||
auto colors = Loader.fromString(yaml_input).load();
|
||||
|
||||
foreach(string color, string value; colors)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue