1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

push partial name regexp up

we know that all child templates will be considered as "partials", so
the only one that needs detection by name is the root node
This commit is contained in:
Aaron Patterson 2016-02-18 15:12:18 -08:00
parent 5ae91da119
commit 8a5059383e

View file

@ -28,7 +28,8 @@ module ActionView
# (Concurrent::Map's lookups have volatile semantics) # (Concurrent::Map's lookups have volatile semantics)
finder.digest_cache[cache_key] || @@digest_mutex.synchronize do finder.digest_cache[cache_key] || @@digest_mutex.synchronize do
finder.digest_cache.fetch(cache_key) do # re-check under lock finder.digest_cache.fetch(cache_key) do # re-check under lock
root = tree(name, finder) partial = name.include?("/_")
root = tree(name, finder, partial)
dependencies.each do |injected_dep| dependencies.each do |injected_dep|
root.children << Injected.new(injected_dep, nil, nil) root.children << Injected.new(injected_dep, nil, nil)
end end
@ -44,7 +45,6 @@ module ActionView
# Create a dependency tree for template named +name+. # Create a dependency tree for template named +name+.
def tree(name, finder, partial = false, seen = {}) def tree(name, finder, partial = false, seen = {})
logical_name = name.gsub(%r|/_|, "/") logical_name = name.gsub(%r|/_|, "/")
partial = partial || name.include?("/_")
if finder.disable_cache { finder.exists?(logical_name, [], partial) } if finder.disable_cache { finder.exists?(logical_name, [], partial) }
template = finder.disable_cache { finder.find(logical_name, [], partial) } template = finder.disable_cache { finder.find(logical_name, [], partial) }