mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove query_format argument from resolver
This commit is contained in:
parent
c214546217
commit
bcd42ae974
3 changed files with 5 additions and 5 deletions
|
@ -212,7 +212,7 @@ module ActionView
|
||||||
template_paths = reject_files_external_to_app(template_paths) unless outside_app_allowed
|
template_paths = reject_files_external_to_app(template_paths) unless outside_app_allowed
|
||||||
|
|
||||||
template_paths.map do |template|
|
template_paths.map do |template|
|
||||||
handler, format, variant = extract_handler_and_format_and_variant(template, formats.first)
|
handler, format, variant = extract_handler_and_format_and_variant(template)
|
||||||
|
|
||||||
FileTemplate.new(File.expand_path(template), handler,
|
FileTemplate.new(File.expand_path(template), handler,
|
||||||
virtual_path: path.virtual,
|
virtual_path: path.virtual,
|
||||||
|
@ -280,7 +280,7 @@ module ActionView
|
||||||
# Extract handler, formats and variant from path. If a format cannot be found neither
|
# 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
|
# from the path, or the handler, we should return the array of formats given
|
||||||
# to the resolver.
|
# to the resolver.
|
||||||
def extract_handler_and_format_and_variant(path, query_format)
|
def extract_handler_and_format_and_variant(path)
|
||||||
pieces = File.basename(path).split(".")
|
pieces = File.basename(path).split(".")
|
||||||
pieces.shift
|
pieces.shift
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ module ActionView #:nodoc:
|
||||||
@hash.each do |_path, array|
|
@hash.each do |_path, array|
|
||||||
source, updated_at = array
|
source, updated_at = array
|
||||||
next unless query.match?(_path)
|
next unless query.match?(_path)
|
||||||
handler, format, variant = extract_handler_and_format_and_variant(_path, :html)
|
handler, format, variant = extract_handler_and_format_and_variant(_path)
|
||||||
templates << Template.new(source, _path, handler,
|
templates << Template.new(source, _path, handler,
|
||||||
virtual_path: path.virtual,
|
virtual_path: path.virtual,
|
||||||
format: format,
|
format: format,
|
||||||
|
@ -50,7 +50,7 @@ module ActionView #:nodoc:
|
||||||
|
|
||||||
class NullResolver < PathResolver
|
class NullResolver < PathResolver
|
||||||
def query(path, exts, _, _, locals)
|
def query(path, exts, _, _, locals)
|
||||||
handler, format, variant = extract_handler_and_format_and_variant(path, :html)
|
handler, format, variant = extract_handler_and_format_and_variant(path)
|
||||||
[ActionView::Template.new("Template generated by Null Resolver", path.virtual, handler, virtual_path: path.virtual, format: format, variant: variant, locals: locals)]
|
[ActionView::Template.new("Template generated by Null Resolver", path.virtual, handler, virtual_path: path.virtual, format: format, variant: variant, locals: locals)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,6 @@ class NullResolverTest < ActiveSupport::TestCase
|
||||||
assert_equal 1, templates.size, "expected one template"
|
assert_equal 1, templates.size, "expected one template"
|
||||||
assert_equal "Template generated by Null Resolver", templates.first.source
|
assert_equal "Template generated by Null Resolver", templates.first.source
|
||||||
assert_equal "arbitrary/path.erb", templates.first.virtual_path.to_s
|
assert_equal "arbitrary/path.erb", templates.first.virtual_path.to_s
|
||||||
assert_equal :html, templates.first.format
|
assert_nil templates.first.format
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue