# File actionview/lib/action_view/digestor.rb, line 16
def digest(name,, format: nil, finder,, dependencies: nil)
if dependencies.nil? || dependencies.empty?
cache_key = "#{name}.#{format}"
else
dependencies_suffix = dependencies.flatten.tap(&:compact!).join(".")
cache_key = "#{name}.#{format}.#{dependencies_suffix}"
end
# this is a correctly done double-checked locking idiom
# (Concurrent::Map's lookups have volatile semantics)
finder.digest_cache[cache_key] || @@digest_mutex.synchronize do
finder.digest_cache.fetch(cache_key) do # re-check under lock
path = TemplatePath.parse(name)
root = tree(path.to_s, finder, path.partial?)
dependencies.each do |injected_dep|
root.children << Injected.new(injected_dep, nil, nil)
end if dependencies
finder.digest_cache[cache_key] = root.digest(finder)
end
end
end