Created
April 11, 2019 02:22
-
-
Save SLiNv/c2e119c60efb31b31b9751b395c45678 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PathSet #:nodoc: | |
def find_file(path, prefixes = [], *args) | |
_find_all(path, prefixes, args, true).first || raise(MissingTemplate.new(self, path, prefixes, *args)) | |
end | |
private | |
def _find_all(path, prefixes, args, outside_app) | |
prefixes = [prefixes] if String === prefixes | |
prefixes.each do |prefix| | |
paths.each do |resolver| | |
if outside_app | |
templates = resolver.find_all_anywhere(path, prefix, *args) | |
else | |
templates = resolver.find_all(path, prefix, *args) | |
end | |
return templates unless templates.empty? | |
end | |
end | |
[] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment