Module: NYNY::Templates::Helpers

Defined in:
lib/nyny/templates.rb

Instance Method Summary collapse

Instance Method Details

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



6
7
8
9
10
# File 'lib/nyny/templates.rb', line 6

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

#template_cacheObject



12
13
14
# File 'lib/nyny/templates.rb', line 12

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