ExBuilder v0.1.0 ExBuilder.Template
DSL for building complex Map structures. This is very Ruby builder-like templating.
Summary
Macros
Add an array property to the object context by iterating on list param.
Each item in the given list param is available inside array block as an 'item' variable
Provides access to the variables inside ‘assigns’ variable in the caller’s scope
Document entry point. This macro is used as a wrapper for a document generation
Provides access to the variables inside ‘assigns’ variable in the caller’s scope
Add a property to the object context
Functions
Macros
Add an array property to the object context by iterating on list param.
Each item in the given list param is available inside array block as an 'item' variable
##Example:
iex> document do
iex> object(:work, %{name: "Development"})
iex> array(:names, ["Joe", "Phil"]) do
iex> %{name: item}
iex> end
iex> end
%{work: %{name: "Development"}, names: [%{name: "Joe"}, %{name: "Phil"}] }
Provides access to the variables inside 'assigns' variable in the caller's scope
##Example:
iex> var!(assigns) = [name: "Alex"]
iex> document do
iex> name = assign(:name)
iex> property(:name, name)
iex> end
%{name: "Alex"}
Document entry point. This macro is used as a wrapper for a document generation.
##Example:
iex> document do
iex> property(:name, "Alex")
iex> end
%{name: "Alex"}
Provides access to the variables inside 'assigns' variable in the caller's scope
##Example:
iex> document do
iex> object(:sample, %{name: "Joe"})
iex> end
%{sample: %{name: "Joe"}}
iex> document do
iex> object(:sample, %{name: "Joe"}) do
iex> object(:children) do
iex> object(:child, %{name: "Phil"})
iex> end
iex> end
iex> end
%{sample: %{name: "Joe", children: %{child: %{name: "Phil"}}}}