Class: Mjml::Handler

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

Instance Method Summary collapse

Instance Method Details

#call(template) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/mjml.rb', line 37

def call(template)
  compiled_source = haml_handler.call(template)
  if template.formats.include?(:html)
    "Mjml::Mjmltemplate.to_html(begin;#{compiled_source};end).html_safe"
  else
    compiled_source
  end
end

#haml_handlerObject



33
34
35
# File 'lib/mjml.rb', line 33

def haml_handler
  @haml_handler ||= ActionView::Template.registered_template_handler(:haml)
end