class Rouge::Guesser

def self.guess(guessers, lexers)

def self.guess(guessers, lexers)
  original_size = lexers.size
  guessers.each do |g|
    new_lexers = case g
    when Guesser then g.filter(lexers)
    when proc { |x| x.respond_to? :call } then g.call(lexers)
    else raise "bad guesser: #{g}"
    end
    lexers = new_lexers && new_lexers.any? ? new_lexers : lexers
  end
  # if we haven't filtered the input at *all*,
  # then we have no idea what language it is,
  # so we bail and return [].
  lexers.size < original_size ? lexers : []
end