-module(yum@yaml@builder).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/yum/yaml/builder.gleam").
-export([null/0, bool/1, int/1, float/1, string/1, sequence/1, mapping/1]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Build YAML nodes in Gleam code.\n"
"\n"
" The functions in this module create synthetic [`Node`](./node.html#Node)\n"
" values. Pass the root node to [`yum/yaml.from_node`](../yaml.html#from_node)\n"
" when you want to emit it as YAML or use it with the rest of the public YAML\n"
" API.\n"
"\n"
" ```gleam\n"
" import yum/yaml\n"
" import yum/yaml/builder\n"
"\n"
" pub fn example() {\n"
" let document =\n"
" builder.mapping([\n"
" #(builder.string(\"name\"), builder.string(\"yum\")),\n"
" #(\n"
" builder.string(\"commands\"),\n"
" builder.sequence([\n"
" builder.string(\"gleam test\"),\n"
" builder.string(\"gleam format\"),\n"
" ]),\n"
" ),\n"
" ])\n"
" |> yaml.from_node()\n"
"\n"
" let output = yaml.to_string(document)\n"
"\n"
" assert output ==\n"
" \"name: yum\n"
" commands:\n"
" - gleam test\n"
" - gleam format\"\n"
" }\n"
" ```\n"
).
-file("src/yum/yaml/builder.gleam", 40).
?DOC(" Builds a YAML null node.\n").
-spec null() -> yum@yaml@node:node_().
null() ->
yum@yaml@node:synthetic(null).
-file("src/yum/yaml/builder.gleam", 46).
?DOC(" Builds a YAML boolean node.\n").
-spec bool(boolean()) -> yum@yaml@node:node_().
bool(Value) ->
yum@yaml@node:synthetic({bool, Value}).
-file("src/yum/yaml/builder.gleam", 52).
?DOC(" Builds a YAML integer node.\n").
-spec int(integer()) -> yum@yaml@node:node_().
int(Value) ->
yum@yaml@node:synthetic({int, Value}).
-file("src/yum/yaml/builder.gleam", 62).
?DOC(
" Builds a YAML floating-point node.\n"
"\n"
" YAML's special float values are represented as separate node kinds. Use\n"
" [`node.synthetic`](./node.html#synthetic) with [`node.PosInf`](./node.html#Kind),\n"
" [`node.NegInf`](./node.html#Kind), or [`node.Nan`](./node.html#Kind) for\n"
" those values.\n"
).
-spec float(float()) -> yum@yaml@node:node_().
float(Value) ->
yum@yaml@node:synthetic({float, Value}).
-file("src/yum/yaml/builder.gleam", 68).
?DOC(" Builds a YAML string node.\n").
-spec string(binary()) -> yum@yaml@node:node_().
string(Value) ->
yum@yaml@node:synthetic({string, Value}).
-file("src/yum/yaml/builder.gleam", 74).
?DOC(" Builds a YAML sequence node from already-built nodes.\n").
-spec sequence(list(yum@yaml@node:node_())) -> yum@yaml@node:node_().
sequence(Entries) ->
yum@yaml@node:synthetic({sequence, Entries}).
-file("src/yum/yaml/builder.gleam", 80).
?DOC(" Builds a YAML mapping node from already-built key/value node pairs.\n").
-spec mapping(list({yum@yaml@node:node_(), yum@yaml@node:node_()})) -> yum@yaml@node:node_().
mapping(Entries) ->
yum@yaml@node:synthetic({mapping, Entries}).