Updated Loader examples.

This commit is contained in:
Ferdinand Majerech 2014-07-31 02:22:42 +02:00
parent 626337f6ed
commit e100047572

View file

@ -55,17 +55,15 @@ import dyaml.token;
/// ///
/// Load YAML from memory: /// Load YAML from memory:
/// -------------------- /// --------------------
/// import std.stream; /// char[] yaml_input = "red: '#ff0000'\n"
/// import std.stdio;
///
/// string yaml_input = "red: '#ff0000'\n"
/// "green: '#00ff00'\n" /// "green: '#00ff00'\n"
/// "blue: '#0000ff'"; /// "blue: '#0000ff'".dup;
/// ///
/// auto colors = Loader.fromString(yaml_input).load(); /// auto colors = Loader.fromString(yaml_input).load();
/// ///
/// foreach(string color, string value; colors) /// foreach(string color, string value; colors)
/// { /// {
/// import std.stdio;
/// writeln(color, " is ", value, " in HTML/CSS"); /// writeln(color, " is ", value, " in HTML/CSS");
/// } /// }
/// -------------------- /// --------------------
@ -360,11 +358,11 @@ struct Loader
unittest unittest
{ {
string yaml_input = "red: '#ff0000'\n" char[] yaml_input = "red: '#ff0000'\n"
"green: '#00ff00'\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) foreach(string color, string value; colors)
{ {