Class: Middleman::TemplateRenderer::Cache
- Inherits:
-
Object
- Object
- Middleman::TemplateRenderer::Cache
- Defined in:
- lib/middleman-core/template_renderer.rb
Instance Method Summary collapse
- #clear ⇒ Object
- #fetch(*key) ⇒ Object
-
#initialize ⇒ Cache
constructor
A new instance of Cache.
Constructor Details
#initialize ⇒ Cache
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
#clear ⇒ Object
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 |