Class Tilt::Cache
In: lib/tilt.rb
Parent: Object

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.

Methods

clear   fetch   new  

Public Class methods

[Source]

     # File lib/tilt.rb, line 341
341:     def initialize
342:       @cache = {}
343:     end

Public Instance methods

[Source]

     # File lib/tilt.rb, line 349
349:     def clear
350:       @cache = {}
351:     end

[Source]

     # File lib/tilt.rb, line 345
345:     def fetch(*key)
346:       @cache[key] ||= yield
347:     end

[Validate]