Platem.Populator (platem v0.1.0)
This module is a GenServer responsible for populating a template.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Find a field with the same name.
Populates a template with the given values.
Link to this section Functions
Link to this function
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
Link to this function
find_field(name, list)
Find a field with the same name.
Examples
iex> Platem.Populator.find_field("name", [%Platem.Field{name: "name", default: "default"}])
%Platem.Field{name: "name", default: "default"}
Link to this function
populate(template, list)
Populates a template with the given values.
Example
iex> Platem.Populator.populate(%Platem.Template{template: "{{name}}", fields: [%Platem.Field{name: "name", default: "default"}], clause: {"{{", "}}"}}, [%Platem.Value{name: "name", value: "value"}])
%Platem.Template{template: "value", fields: [%Platem.Field{name: "name", default: "name"}]}