Class: Middleman::TemplateRenderer::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/middleman-core/template_renderer.rb

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



13
14
15
# File 'lib/middleman-core/template_renderer.rb', line 13

def initialize
  @cache = {}
end

Instance Method Details

#clearObject



22
23
24
# File 'lib/middleman-core/template_renderer.rb', line 22

def clear
  @cache = {}
end

#fetch(*key) ⇒ Object



17
18
19
20
# File 'lib/middleman-core/template_renderer.rb', line 17

def fetch(*key)
  @cache[key] = yield unless @cache.key?(key)
  @cache[key]
end