Sha256: 9a01b4d3bec4443e4dffcf6e567cfb27d5dfbebeedee7b1b87352bd2a4b9def9

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

require "activesearch/result"

module ActiveSearch
  class Proxy
    include Enumerable

    extend Forwardable

    def_delegators :@results_set, :total_pages, :total_entries, :per_page, :page

    def initialize(results_set, text, options)
      @results_set    = results_set
      @text           = text
      @options        = options
    end

    def each(&block)
      @results_set.results.map do |result|
        _result = @results_set.parse(result)
        block.call(Result.new(_result, @text, @options))
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activesearch-0.3.2 lib/activesearch/proxy.rb