Sha256: d8db90e758c94ed089019d15d1b00dacd6fde37ea346302a00b1f63b482097d7

Contents?: true

Size: 469 Bytes

Versions: 3

Compression:

Stored size: 469 Bytes

Contents

require "activesearch/result"

module ActiveSearch
  class Proxy
    include Enumerable

    def initialize(text, conditions, options = {}, &implementation)
      @text           = text
      @conditions     = conditions
      @options        = options
      @implementation = implementation
    end

    def each(&block)
      @implementation.call(@text, @conditions).each do |result|
        block.call(Result.new(result, @text, @options))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activesearch-0.3.1 lib/activesearch/proxy.rb
activesearch-0.3.0 lib/activesearch/proxy.rb
activesearch-0.2.0 lib/activesearch/proxy.rb