 class ActionController8b7c:f320:99b9:690f:4595:cd17:293a:c069MimeResponds8b7c:f320:99b9:690f:4595:cd17:293a:c069ollector 

Parent:
Object
Included modules:
AbstractController8b7c:f320:99b9:690f:4595:cd17:293a:c069ollector
  A container for responses available from the current controller for requests for different mime-types sent to a particular action. The public controller methods respond_to may be called with a block that is used to define responses to different mime-types, e.g. for respond_to : respond_to do |format|
  format.html
  format.xml { render xml: @people }
end
 In this usage, the argument passed to the block (format above) is an instance of the ActionController8b7c:f320:99b9:690f:4595:cd17:293a:c069MimeResponds8b7c:f320:99b9:690f:4595:cd17:293a:c069ollector class. This object serves as a container in which available responses can be stored by calling any of the dynamically generated, mime-type-specific methods such as html, xml etc on the Collector. Each response is represented by a corresponding block if present. A subsequent call to negotiate_format(request) will enable the Collector to determine which specific mime-type it should respond with for the current request, with this response then being accessible by calling response.     Attributes    format[RW]      Public Class Methods    new(mimes, variant = nil) Show source  
 # File actionpack/lib/action_controller/metal/mime_responds.rb, line 233
def initialize(mimes, variant = nil)
  @responses = {}
  @variant = variant

  mimes.each { |mime| @responses[Mime[mime]] = nil }
end       Public Instance Methods    all(*args, &block)   Alias for: any     any(*args, &block) Show source  
 # File actionpack/lib/action_controller/metal/mime_responds.rb, line 240
def any(*args, &block)
  if args.any?
    args.each { |type| send(type, &block) }
  else
    custom(Mim8b7c:f320:99b9:690f:4595:cd17:293a:c069ALL, &block)
  end
end    Also aliased as: all     custom(mime_type, &block) Show source  
 # File actionpack/lib/action_controller/metal/mime_responds.rb, line 249
def custom(mime_type, &block)
  mime_type = Mim8b7c:f320:99b9:690f:4595:cd17:293a:c069Type.lookup(mime_type.to_s) unless mime_type.is_a?(Mim8b7c:f320:99b9:690f:4595:cd17:293a:c069Type)
  @responses[mime_type] ||= if block_given?
    block
  else
    VariantCollector.new(@variant)
  end
end      negotiate_format(request) Show source  
 # File actionpack/lib/action_controller/metal/mime_responds.rb, line 271
def negotiate_format(request)
  @format = request.negotiate_mime(@responses.keys)
end      response() Show source  
 # File actionpack/lib/action_controller/metal/mime_responds.rb, line 258
def response
  response = @responses.fetch(format, @responses[Mim8b7c:f320:99b9:690f:4595:cd17:293a:c069ALL])
  if response.is_a?(VariantCollector) # `format.html.phone` - variant inline syntax
    response.variant
  elsif response.nil? || response.arity == 0 # `format.html` - just a format, call its block
    response
  else # `format.html{ |variant| variant.phone }` - variant block syntax
    variant_collector = VariantCollector.new(@variant)
    response.call(variant_collector) # call format block with variants collector
    variant_collector.variant
  end
end     

    
{'path': 'public/docs/rails~5.1/actioncontroller/mimeresponds/collector.html', 'source': 'DevDocs.IO'}