2020-06-08 23:37:11 +02:00
|
|
|
defmodule Openpod.Utility.Format do
|
2020-06-06 12:32:51 +02:00
|
|
|
@moduledoc """
|
|
|
|
This module provides utility to format a string
|
|
|
|
"""
|
2020-05-23 23:51:56 +02:00
|
|
|
|
|
|
|
def compile(subject, replacements) do
|
|
|
|
replacements
|
|
|
|
|> Enum.reduce(subject, fn {replacement_key, replacement_value}, subject -> String.replace(subject, "{#{replacement_key}}", replacement_value) end)
|
|
|
|
end
|
2020-06-06 12:32:51 +02:00
|
|
|
end
|