method
build_regex
rails latest stable - Class:
ActionView::OptimizedFileSystemResolver
build_regex(path, details)private
No documentation available.
# File actionview/lib/action_view/template/resolver.rb, line 395
def build_regex(path, details)
query = Regexp.escape(File.join(@path, path))
exts = EXTENSIONS.map do |ext, prefix|
match =
if ext == :variants && details[ext] == :any
".*?"
else
arr = details[ext].compact
arr.uniq!
arr.map! { |e| Regexp.escape(e) }
arr.join("|")
end
prefix = Regexp.escape(prefix)
"(#{prefix}(?<#{ext}>#{match}))?"
end.join
%{\A#{query}#{exts}\z}
end