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