diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-07-15 23:32:45 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-07-26 19:21:14 +0200 |
commit | a6509d31126d3533689480a5290f518671d5d8c9 (patch) | |
tree | 2a4ae12f52013563dd3520c45f75e836dbe1179c /actionview/lib/action_view/template/resolver.rb | |
parent | cdc32defcfc2ce5312c4b02e09f6cef2172843c6 (diff) | |
download | rails-a6509d31126d3533689480a5290f518671d5d8c9.tar.gz rails-a6509d31126d3533689480a5290f518671d5d8c9.tar.bz2 rails-a6509d31126d3533689480a5290f518671d5d8c9.zip |
Add wildcard template dependencies.
Diffstat (limited to 'actionview/lib/action_view/template/resolver.rb')
-rw-r--r-- | actionview/lib/action_view/template/resolver.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb index e7208cce49..28967f40a6 100644 --- a/actionview/lib/action_view/template/resolver.rb +++ b/actionview/lib/action_view/template/resolver.rb @@ -52,6 +52,7 @@ module ActionView def initialize @data = SmallCache.new(&KEY_BLOCK) + @query_cache = SmallCache.new end # Cache the templates returned by the block @@ -70,8 +71,17 @@ module ActionView end end + def cache_query(query) # :nodoc: + if Resolver.caching? + @query_cache[query] ||= canonical_no_templates(yield) + else + yield + end + end + def clear @data.clear + @query_cache.clear end private @@ -116,6 +126,10 @@ module ActionView end end + def find_all_with_query(query) # :nodoc: + @cache.cache_query(query) { find_template_paths(File.join(@path, query)) } + end + private delegate :caching?, to: :class |