class Mime::Type::AcceptList
:nodoc:
def app_xml
def app_xml self[app_xml_idx] end
def app_xml_idx
def app_xml_idx @app_xml_idx ||= index(Mime::XML.to_s) end
def assort!
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
def exchange_xml_items
def exchange_xml_items self[app_xml_idx], self[text_xml_idx] = text_xml, app_xml @app_xml_idx, @text_xml_idx = text_xml_idx, app_xml_idx end
def text_xml
def text_xml self[text_xml_idx] end
def text_xml_idx
def text_xml_idx @text_xml_idx ||= index('text/xml') end