Extremely simple template cache implementation. Calling applications create a Tilt::Cache instance and use fetch with any set of hashable arguments (such as those to Tilt.new):
cache = Tilt::Cache.new cache.fetch(path, line, options) { Tilt.new(path, line, options) }
Subsequent invocations return the already loaded template object.
# File lib/tilt.rb, line 345 def initialize @cache = {} end
# File lib/tilt.rb, line 353 def clear @cache = {} end
# File lib/tilt.rb, line 349 def fetch(*key) @cache[key] ||= yield end