Sha256: c9099e0c693e7dd9371b7475e565b8bf48ac6ee5d663d56b51fad34a06c73c83

Contents?: true

Size: 444 Bytes

Versions: 17

Compression:

Stored size: 444 Bytes

Contents

# frozen_string_literal: true

class ThinkingSphinx::BatchedSearch
  attr_accessor :searches

  def initialize
    @searches = []
  end

  def populate(middleware = ThinkingSphinx::Middlewares::DEFAULT)
    return if populated? || searches.empty?

    middleware.call contexts
    searches.each &:populated!

    @populated = true
  end

  private

  def contexts
    searches.collect &:context
  end

  def populated?
    @populated
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-5.5.1 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-5.5.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-5.4.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-5.3.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-5.2.1 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-5.2.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-5.1.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-5.0.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-4.4.1 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-4.4.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-4.3.2 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-4.3.1 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-4.3.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-4.2.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-4.1.0 lib/thinking_sphinx/batched_search.rb
thinking-sphinx-4.0.0 lib/thinking_sphinx/batched_search.rb