aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template/resolver.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-03-08 23:13:24 +0100
committerJosé Valim <jose.valim@gmail.com>2010-03-08 23:25:16 +0100
commit8f082ff4217175f52234f2223658619a9c923afc (patch)
tree10b106df434109c5b5a117a06239a86be8266053 /actionpack/lib/action_view/template/resolver.rb
parent01f0e47663bbbc593af0c36d4cf49124b200e3d8 (diff)
downloadrails-8f082ff4217175f52234f2223658619a9c923afc.tar.gz
rails-8f082ff4217175f52234f2223658619a9c923afc.tar.bz2
rails-8f082ff4217175f52234f2223658619a9c923afc.zip
Clean LookupContext API.
Diffstat (limited to 'actionpack/lib/action_view/template/resolver.rb')
-rw-r--r--actionpack/lib/action_view/template/resolver.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb
index 9a011f7638..6e6c4c21ee 100644
--- a/actionpack/lib/action_view/template/resolver.rb
+++ b/actionpack/lib/action_view/template/resolver.rb
@@ -10,16 +10,20 @@ module ActionView
Hash.new { |h2,k2| h2[k2] = Hash.new { |h3, k3| h3[k3] = {} } } }
end
+ def clear_cache
+ @cached.clear
+ end
+
def find(*args)
find_all(*args).first
end
# Normalizes the arguments and passes it on to find_template.
- def find_all(name, details = {}, prefix = nil, partial = nil, key=nil)
+ def find_all(name, prefix=nil, partial=false, details={}, key=nil)
name, prefix = normalize_name(name, prefix)
cached(key, prefix, name, partial) do
- find_templates(name, details, prefix, partial)
+ find_templates(name, prefix, partial, details)
end
end
@@ -32,7 +36,7 @@ module ActionView
# This is what child classes implement. No defaults are needed
# because Resolver guarantees that the arguments are present and
# normalized.
- def find_templates(name, details, prefix, partial)
+ def find_templates(name, prefix, partial, details)
raise NotImplementedError
end
@@ -68,12 +72,12 @@ module ActionView
private
- def find_templates(name, details, prefix, partial)
- path = build_path(name, details, prefix, partial)
+ def find_templates(name, prefix, partial, details)
+ path = build_path(name, prefix, partial, details)
query(path, EXTENSION_ORDER.map { |ext| details[ext] })
end
- def build_path(name, details, prefix, partial)
+ def build_path(name, prefix, partial, details)
path = ""
path << "#{prefix}/" unless prefix.empty?
path << (partial ? "_#{name}" : name)