Class: Mime::Type::AcceptList
- Inherits:
-
Array
- Object
- Array
- Mime::Type::AcceptList
- Defined in:
- lib/action_dispatch/http/mime_type.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#assort! ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/action_dispatch/http/mime_type.rb', line 89 def assort! sort! # Take care of the broken text/xml entry by renaming or deleting it if text_xml_idx && app_xml_idx app_xml.q = [text_xml.q, app_xml.q].max # set the q value to the max of the two exchange_xml_items if app_xml_idx > text_xml_idx # make sure app_xml is ahead of text_xml in the list delete_at(text_xml_idx) # delete text_xml from the list elsif text_xml_idx text_xml.name = Mime::XML.to_s end # Look for more specific XML-based types and sort them ahead of app/xml if app_xml_idx idx = app_xml_idx while idx < length type = self[idx] break if type.q < app_xml.q if type.name.ends_with? '+xml' self[app_xml_idx], self[idx] = self[idx], app_xml @app_xml_idx = idx end idx += 1 end end map! { |i| Mime::Type.lookup(i.name) }.uniq! to_a end |