Class: Angelo::Templates::TemplateCaching::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/angelo/templates.rb

Overview

A pull request has been accepted for Tilt which makes Tilt::Cache work like our Cache so we can remove this when a new Tilt gem is released (currently 2.0.1), but Tilt doesn’t seem to be getting much love these days.

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



90
91
92
# File 'lib/angelo/templates.rb', line 90

def initialize
  @cache = {}
end

Instance Method Details

#fetch(*key) ⇒ Object



94
95
96
97
98
# File 'lib/angelo/templates.rb', line 94

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