module ActionController::MimeResponds

def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:

:nodoc:
is available.
Sends :not_acceptable to the client and returns nil if no suitable format

In typical usage this is the block passed to +respond_with+ or +respond_to+.
for the current request, based on the available responses defined by a block.
Returns a Collector object containing the appropriate mime-type response
def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
  mimes ||= collect_mimes_from_class_level
  collector = Collector.new(mimes)
  block.call(collector) if block_given?
  format = collector.negotiate_format(request)
  if format
    self.content_type ||= format.to_s
    lookup_context.formats = [format.to_sym]
    lookup_context.rendered_format = lookup_context.formats.first
    collector
  else
    raise ActionController::UnknownFormat
  end
end