Class: HtmlEmailCreator::Layout

Inherits:
Object
  • Object
show all
Defined in:
lib/html_email_creator/layout.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, default_data = HtmlEmailCreator.settings.extension_data) ⇒ Layout

Returns a new instance of Layout.



5
6
7
8
9
# File 'lib/html_email_creator/layout.rb', line 5

def initialize(text, default_data = HtmlEmailCreator.settings.extension_data)
  @text = text
  @template = Liquid::Template.parse(text)
  @default_data = default_data
end

Instance Method Details

#to_html(data = {}, *filters) ⇒ Object



11
12
13
# File 'lib/html_email_creator/layout.rb', line 11

def to_html(data = {}, *filters)
  @template.render(@default_data.merge(data), :filters => [HtmlEmailCreator::Filters] + filters)
end