Sha256: 8c2df389ce1cc816fba5bde7e59297b5d352c0677d36187da2738f6e2584191f

Contents?: true

Size: 396 Bytes

Versions: 79

Compression:

Stored size: 396 Bytes

Contents

module Ddr::Index
  class AbstractQueryResult
    include Enumerable

    attr_reader :query
    delegate :params, to: :query

    def initialize(query)
      @query = query.dup.freeze
    end

    def count
      response = Connection.select(params, rows: 0)
      response.num_found
    end

    def each
      raise NotImplementedError, "Subclasses must implement `#each`."
    end

  end
end

Version data entries

79 entries across 79 versions & 2 rubygems

Version Path
ddr-models-2.7.1 lib/ddr/index/abstract_query_result.rb
ddr-models-2.7.0 lib/ddr/index/abstract_query_result.rb
ddr-models-2.7.0.rc1 lib/ddr/index/abstract_query_result.rb
ddr-models-2.6.2 lib/ddr/index/abstract_query_result.rb
ddr-models-2.6.1 lib/ddr/index/abstract_query_result.rb
ddr-models-2.6.0 lib/ddr/index/abstract_query_result.rb
ddr-models-2.6.0.rc4 lib/ddr/index/abstract_query_result.rb
ddr-models-2.6.0.rc3 lib/ddr/index/abstract_query_result.rb
ddr-models-2.6.0.rc2 lib/ddr/index/abstract_query_result.rb
ddr-models-2.6.0.rc1 lib/ddr/index/abstract_query_result.rb
ddr-models-2.5.3 lib/ddr/index/abstract_query_result.rb
ddr-models-2.5.2 lib/ddr/index/abstract_query_result.rb
ddr-models-2.5.1 lib/ddr/index/abstract_query_result.rb
ddr-models-2.5.0 lib/ddr/index/abstract_query_result.rb
ddr-models-2.5.0.rc1 lib/ddr/index/abstract_query_result.rb
ddr-models-2.4.16 lib/ddr/index/abstract_query_result.rb
ddr-models-2.4.15 lib/ddr/index/abstract_query_result.rb
ddr-models-2.4.14 lib/ddr/index/abstract_query_result.rb
ddr-models-2.4.13 lib/ddr/index/abstract_query_result.rb