Module: Nesta::Overrides::Renderers

Defined in:
lib/nesta-plugin-diskcached/init.rb

Overview

Override renderers to include cacheing.

Instance Method Summary collapse

Instance Method Details

#erb(template, options = {}, locals = {}) ⇒ Object

Override erb to include diskcached



45
46
47
48
49
50
# File 'lib/nesta-plugin-diskcached/init.rb', line 45

def erb(template, options = {}, locals = {})
  $diskcached.cache(Digest::SHA1.hexdigest(request.url+template.to_s+options.to_s+locals.to_s)) do
    defaults, engine = Overrides.render_options(template, :erb)
    super(template, defaults.merge(options), locals)
  end
end

#haml(template, options = {}, locals = {}) ⇒ Object

Override haml to include diskcached



37
38
39
40
41
42
# File 'lib/nesta-plugin-diskcached/init.rb', line 37

def haml(template, options = {}, locals = {})
  $diskcached.cache(Digest::SHA1.hexdigest(request.url+template.to_s+options.to_s+locals.to_s)) do
    defaults, engine = Overrides.render_options(template, :haml)
    super(template, defaults.merge(options), locals)
  end
end