class Cell::Templates::Cache
{[“comment/row/views”, comment/views“] => ”Tpl:comment/view/show.haml“}
Public Class Methods
new()
click to toggle source
# File lib/cell/templates.rb, line 32 def initialize @store = {} end
Public Instance Methods
fetch(prefixes, view) { |prefix| ... }
click to toggle source
Iterates prefixes and yields block. Returns and caches when block returned template. Note that it caches per prefixes set as this will most probably never change.
# File lib/cell/templates.rb, line 38 def fetch(prefixes, view) template = get(prefixes, view) and return template # cache hit. prefixes.find do |prefix| template = yield(prefix) and return store(prefixes, view, template) end end
Private Instance Methods
get(prefixes, view)
click to toggle source
store(prefix, view, template)
click to toggle source
# File lib/cell/templates.rb, line 53 def store(prefix, view, template) @store[prefix][view] = template # the nested hash is always present here. end