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)
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.nil? @variants[:none] || @variants[:any] elsif (@variants.keys & @variant).any? @variant.each do |v| return @variants[v] if @variants.key?(v) end else @variants[:any] end end