Easy template language in ruby, with only variable substitution.
# Arguments:
# text: (String)
# the string containing your template
# variables: (Hash)
# the hash containing the values to substitute in place of the keys
# enclosed by { and }.
EasyTemplate::process(text, variables)
NB: If you want to use raw {
in your template you can escape it with \
.
EasyTemplate::process('Hello Mr {last name}!', {
'last name' => 'Bowie'
})
Hello Mr Bowie!
EasyTemplate::process('\{first name} {last name}!', {
'first name' => 'Nina',
'last name' => 'Simone'
})
{first name} Simone!
Copyright © 2016 Jérémy Lecerf, EasyTemplate is free software, and may be redistributed under the terms specified in the license.