From ca5e23ed4d8818d81314953aadd422b2cbde63b0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 25 Feb 2019 13:18:44 -0800 Subject: Templates have one format Templates only have one format. Before this commit, templates would be constructed with a single element array that contained the format. This commit eliminates the single element array and just implements a `format` method. This saves one array allocation per template. --- actionview/lib/action_view/helpers/cache_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/lib/action_view/helpers/cache_helper.rb') diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index 6b69b71947..020aebeea3 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -217,7 +217,7 @@ module ActionView end def digest_path_from_template(template) # :nodoc: - digest = Digestor.digest(name: template.virtual_path, format: template.formats.first, finder: lookup_context, dependencies: view_cache_dependencies) + digest = Digestor.digest(name: template.virtual_path, format: template.format, finder: lookup_context, dependencies: view_cache_dependencies) if digest.present? "#{template.virtual_path}:#{digest}" -- cgit v1.2.3