Skip to content

Commit

Permalink
Clean up PathSet.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Dec 27, 2010
1 parent 6b09997 commit ecc83c1
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions actionpack/lib/action_view/path_set.rb
Expand Up @@ -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
Expand Down

0 comments on commit ecc83c1

Please sign in to comment.