Method: ActionDispatch::Http::MimeNegotiation#negotiate_mime

Defined in:
actionpack/lib/action_dispatch/http/mime_negotiation.rb

#negotiate_mime(order) ⇒ Object

Returns the first MIME type that matches the provided array of MIME types.



143
144
145
146
147
148
149
150
151
152
153
# File 'actionpack/lib/action_dispatch/http/mime_negotiation.rb', line 143

def negotiate_mime(order)
  formats.each do |priority|
    if priority == Mime::ALL
      return order.first
    elsif order.include?(priority)
      return priority
    end
  end

  order.include?(Mime::ALL) ? format : nil
end