Permalink
Browse files

Clean up PathSet.

  • Loading branch information...
1 parent 6b09997 commit ecc83c1e6e36913c60d7107fb549c504b1a1e72c @josevalim josevalim committed Dec 27, 2010
Showing with 4 additions and 19 deletions.
  1. +4 −19 actionpack/lib/action_view/path_set.rb
@@ -11,36 +11,21 @@ def #{method}(*args)
end
def find(*args)
- if template = find_first(*args)
- template
- else
- raise MissingTemplate.new(self, *args)
- end
+ find_all(*args).first || raise(MissingTemplate.new(self, *args))
end
def find_all(path, prefixes = [], *args)
prefixes.each do |prefix|
- templates = []
each do |resolver|
- templates.concat resolver.find_all(path, prefix, *args)
+ templates = resolver.find_all(path, prefix, *args)
+ return templates unless templates.empty?
end
- return templates unless templates.empty?
end
[]
end
- def find_first(path, prefixes = [], *args)
- prefixes.each do |prefix|
- each do |resolver|
- template = resolver.find_all(path, prefix, *args).first
- return template if template
- end
- end
- nil
- end
-
def exists?(*args)
- !!find_first(*args)
+ find_all(*args).any?
end
protected

0 comments on commit ecc83c1

Please sign in to comment.