Class: Maildis::TemplateRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/maildis/template_renderer.rb

Class Method Summary collapse

Class Method Details

.render(template, merge_fields) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/maildis/template_renderer.rb', line 7

def render(template, merge_fields)
  result = String.new(template.content)
  merge_fields.each do |mf|
    token = /#{Regexp.quote('%' + mf.field + '%')}/
    result.gsub!(token, mf.value)
  end
  result
end