Module: Nancy::Render

Defined in:
lib/nancy/render.rb

Instance Method Summary collapse

Instance Method Details

#render(template, locals = {}, options = {}, &block) ⇒ Object



6
7
8
9
10
# File 'lib/nancy/render.rb', line 6

def render(template, locals = {}, options = {}, &block)
  templates_cache.fetch(template) {
    Tilt.new(template, options)
  }.render(self, locals, &block)
end

#templates_cacheObject



12
13
14
# File 'lib/nancy/render.rb', line 12

def templates_cache
  Thread.current[:templates_cache] ||= Tilt::Cache.new
end