class Thymeleaf::Rails::ThymeleafHandler

Public Instance Methods

call(template) click to toggle source
# File lib/thymeleaf/rails/handler.rb, line 12
def call(template)
  do_render(template.source, template.locals)
end
do_render(template_content, locals) click to toggle source
# File lib/thymeleaf/rails/handler.rb, line 5
def do_render(template_content, locals)
  str = 'th_context = {};'
  str << 'instance_variables.map { |name| th_context[name[1..-1]] = instance_variable_get(name) if name[0].eql?"@" };'
  str << "Thymeleaf::Template.new('#{template_content}', th_context).render.to_s"
  str
end