Class: Middleman::TemplateRenderer::Cache

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

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache


15
16
17
# File 'middleman-core/lib/middleman-core/template_renderer.rb', line 15

def initialize
  @cache = {}
end

Instance Method Details

#clearObject


24
25
26
# File 'middleman-core/lib/middleman-core/template_renderer.rb', line 24

def clear
  @cache = {}
end

#fetch(*key) ⇒ Object


19
20
21
22
# File 'middleman-core/lib/middleman-core/template_renderer.rb', line 19

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