Skip to content

Commit a790203

Browse files
committed
Use Kernel#Array to avoid an extra Array allocation when nil was given
1 parent 9d4075c commit a790203

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

actionpack/lib/action_dispatch/http/mime_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def parse(accept_header)
175175
accept_header = accept_header[0, index]
176176
end
177177
return [] if accept_header.blank?
178-
parse_trailing_star(accept_header) || [Mime::Type.lookup(accept_header)].compact
178+
parse_trailing_star(accept_header) || Array(Mime::Type.lookup(accept_header))
179179
else
180180
list, index = [], 0
181181
accept_header.split(",").each do |header|

0 commit comments

Comments
 (0)