class ActionController::MimeResponds::Collector::VariantCollector

:nodoc:

def any(*args, &block)

def any(*args, &block)
  if block_given?
    if args.any? && args.none? { |a| a == @variant }
      args.each { |v| @variants[v] = block }
    else
      @variants[:any] = block
    end
  end
end

def initialize(variant = nil)

:nodoc:
def initialize(variant = nil)
  @variant = variant
  @variants = {}
end

def method_missing(name, *args, &block)

def method_missing(name, *args, &block)
  @variants[name] = block if block_given?
end

def variant

def variant
  if @variant.empty?
    @variants[:none] || @variants[:any]
  else
    @variants[variant_key]
  end
end

def variant_key

def variant_key
  @variant.find { |variant| @variants.key?(variant) } || :any
end