Extract handler, formats and variant from path. If a format cannot be found
neither from the path, or the handler, we should return the array of
formats given to the resolver.
# File actionview/lib/action_view/template/resolver.rb, line 275
def extract_handler_and_format_and_variant(path)
pieces = File.basename(path).split(".")
pieces.shift
extension = pieces.pop
handler = Template.handler_for_extension(extension)
format, variant = pieces.last.split(EXTENSIONS[:variants], 2) if pieces.last
format = if format
Template::Types[format]&.ref
else
if handler.respond_to?(:default_format) # default_format can return nil
handler.default_format
else
nil
end
end
# Template::Types[format] and handler.default_format can return nil
[handler, format, variant]
end