class ActionView::Resolver

Action View Resolver

def build_path(name, prefix, partial)

Helpers that builds a path. Useful for building virtual paths.
def build_path(name, prefix, partial)
  Path.build(name, prefix, partial)
end

def cached(key, path_info, details, locals) #:nodoc:

:nodoc:
before returning it.
it always hits the resolver but check if the resolver is fresher
always check the cache before hitting the resolver. Otherwise,
Handles templates caching. If a key is given and caching is on
def cached(key, path_info, details, locals) #:nodoc:
  name, prefix, partial = path_info
  locals = locals.map { |x| x.to_s }.sort!
  if key && caching?
    @cached[key][name][prefix][partial][locals] ||= decorate(yield, path_info, details, locals)
  else
    fresh = decorate(yield, path_info, details, locals)
    return fresh unless key
    scope = @cached[key][name][prefix][partial]
    cache = scope[locals]
    mtime = cache && cache.map(&:updated_at).max
    if !mtime || fresh.empty?  || fresh.any? { |t| t.updated_at > mtime }
      scope[locals] = fresh
    else
      cache
    end
  end
end

def clear_cache

def clear_cache
  @cached.clear
end

def decorate(templates, path_info, details, locals) #:nodoc:

:nodoc:
Ensures all the resolver information is set in the template.
def decorate(templates, path_info, details, locals) #:nodoc:
  cached = nil
  templates.each do |t|
    t.locals         = locals
    t.formats        = details[:formats] || [:html] if t.formats.empty?
    t.virtual_path ||= (cached ||= build_path(*path_info))
  end
end

def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])

Normalizes the arguments and passes it on to find_template.
def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])
  cached(key, [name, prefix, partial], details, locals) do
    find_templates(name, prefix, partial, details, false)
  end
end

def find_all_anywhere(name, prefix, partial=false, details={}, key=nil, locals=[])

def find_all_anywhere(name, prefix, partial=false, details={}, key=nil, locals=[])
  cached(key, [name, prefix, partial], details, locals) do
    find_templates(name, prefix, partial, details, true)
  end
end

def find_templates(name, prefix, partial, details, outside_app_allowed = false)

normalized.
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, outside_app_allowed = false)
  raise NotImplementedError, "Subclasses must implement a find_templates(name, prefix, partial, details, outside_app_allowed) method"
end

def initialize

def initialize
  @cached = Hash.new { |h1,k1| h1[k1] = Hash.new { |h2,k2|
    h2[k2] = Hash.new { |h3,k3| h3[k3] = Hash.new { |h4,k4| h4[k4] = {} } } } }
end