class Mrml::Rails::Handler
Public Instance Methods
call(template, source = nil)
click to toggle source
Optional second source parameter to make it work with Rails
>= 6: Beginning with Rails
6 template handlers get the source of the template as the second parameter.
# File lib/mrml/rails/handler.rb, line 16 def call(template, source = nil) compiled_source = if ::Rails::VERSION::MAJOR >= 6 template_handler.call(template, source) else template_handler.call(template) end if compiled_source =~ /<mjml.*?>/i "MRML.to_html(begin;#{compiled_source};end).html_safe" else compiled_source end end
template_handler()
click to toggle source
# File lib/mrml/rails/handler.rb, line 9 def template_handler @template_handler ||= ActionView::Template.registered_template_handler(:erb) end