class Tilt::Cache
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.
Public Class Methods
new()
click to toggle source
# File lib/tilt.rb, line 82 def initialize @cache = {} end
Public Instance Methods
clear()
click to toggle source
Clears the cache.
# File lib/tilt.rb, line 92 def clear @cache = {} end
fetch(*key) { || ... }
click to toggle source
@see Cache
# File lib/tilt.rb, line 87 def fetch(*key) @cache[key] ||= yield end