Sha256: 74113f1c9385e6ecbb5959594a88c9cd86f70a878fa0cd74781c781e1ccd2a22

Contents?: true

Size: 343 Bytes

Versions: 8

Compression:

Stored size: 343 Bytes

Contents

module Census
  class Search
    def initialize(options)
      @options = options
    end
    
    def perform
      results = nil
      @options.each_pair do |question, value|
        users = question.find_answers_matching(value).map(&:user)
        results = results ? results & users : users
      end
      results || []
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
census-0.5.2 lib/census/search.rb
census-0.5.0 lib/census/search.rb
census-0.4.4 lib/census/search.rb
census-0.4.3 lib/census/search.rb
census-0.4.2 lib/census/search.rb
census-0.4.1 lib/census/search.rb
census-0.4.0 lib/census/search.rb
census-0.3.1 lib/census/search.rb