class ActionView::Resolver
def cached(key, prefix, name, partial)
def cached(key, prefix, name, partial) return yield unless key && caching? @cached[key][prefix][name][partial] ||= yield end
def caching?
def caching? @caching ||= !defined?(Rails.application) || Rails.application.config.cache_classes end
def clear_cache
def clear_cache @cached.clear end
def find_all(name, prefix=nil, partial=false, details={}, key=nil)
def find_all(name, prefix=nil, partial=false, details={}, key=nil) cached(key, prefix, name, partial) do find_templates(name, prefix, partial, details) end end
def find_templates(name, prefix, partial, details)
because Resolver guarantees that the arguments are present and
This is what child classes implement. No defaults are needed
def find_templates(name, prefix, partial, details) raise NotImplementedError end
def initialize
def initialize @cached = Hash.new { |h1,k1| h1[k1] = Hash.new { |h2,k2| h2[k2] = Hash.new { |h3, k3| h3[k3] = {} } } } end