module Sinatra::Thymeleaf
Public Instance Methods
thyme(template=nil, locals={}, options = {}, &block)
click to toggle source
# File lib/sinatra/thymeleaf.rb, line 11 def thyme(template=nil, locals={}, options = {}, &block) options, template = template, nil if template.is_a?(Hash) template = lambda { block } if template.nil? locals[:t] = lambda { |m| I18n.t(m) } # setup Sinatra flash locals[:flash] = {} unless flash.nil? locals[:flash] = flash end # add warden current_user if available unless current_user.nil? locals[:current_user] = current_user end render :html, template, options, locals end