aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/digestor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/lib/action_view/digestor.rb')
-rw-r--r--actionview/lib/action_view/digestor.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb
index f3c29d663c..0658d8601d 100644
--- a/actionview/lib/action_view/digestor.rb
+++ b/actionview/lib/action_view/digestor.rb
@@ -1,21 +1,26 @@
-require 'concurrent/map'
-require 'action_view/dependency_tracker'
-require 'monitor'
+require "concurrent/map"
+require "action_view/dependency_tracker"
+require "monitor"
module ActionView
class Digestor
@@digest_mutex = Mutex.new
+ module PerExecutionDigestCacheExpiry
+ def self.before(target)
+ ActionView::LookupContext::DetailsKey.clear
+ end
+ end
+
class << self
# Supported options:
#
# * <tt>name</tt> - Template name
# * <tt>finder</tt> - An instance of <tt>ActionView::LookupContext</tt>
# * <tt>dependencies</tt> - An array of dependent views
- # * <tt>partial</tt> - Specifies whether the template is a partial
def digest(name:, finder:, dependencies: [])
dependencies ||= []
- cache_key = [ name, finder.rendered_format, dependencies ].flatten.compact.join('.')
+ cache_key = [ name, finder.rendered_format, dependencies ].flatten.compact.join(".")
# this is a correctly done double-checked locking idiom
# (Concurrent::Map's lookups have volatile semantics)
@@ -42,8 +47,7 @@ module ActionView
options = {}
options[:formats] = [finder.rendered_format] if finder.rendered_format
- if finder.disable_cache { finder.exists?(logical_name, [], partial, [], options) }
- template = finder.disable_cache { finder.find(logical_name, [], partial, [], options) }
+ if template = finder.disable_cache { finder.find_all(logical_name, [], partial, [], options).first }
finder.rendered_format ||= template.formats.first
if node = seen[template.identifier] # handle cycles in the tree
@@ -105,7 +109,7 @@ module ActionView
class Partial < Node; end
class Missing < Node
- def digest(finder, _ = []) '' end
+ def digest(finder, _ = []) "" end
end
class Injected < Node