Sha256: 5981f6974cc40dd33f4cfdf2d05a0ff0fdaf714335399530f6e25dd48e4e4141

Contents?: true

Size: 706 Bytes

Versions: 12

Compression:

Stored size: 706 Bytes

Contents

module AgnosticBackend
  module Queryable
    class ResultSet

      include Enumerable

      attr_reader :raw_results, :query

      def initialize(raw_results, query)
        @raw_results, @query = raw_results, query
      end

      def each(&block)
        filtered_results.each do |result|
          block.call(transform(result))
        end
      end

      def empty?
        none?
      end

      def total_count
        raise NotImplementedError
      end

      def offset
        raise NotImplementedError
      end

      private

      def filtered_results
        raise NotImplementedError
      end

      def transform(result)
        raise NotImplementedError
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
agnostic_backend-1.0.4 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-1.0.3 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-1.0.2 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-1.0.1 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-1.0.0 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-0.9.9 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-0.9.8 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-0.9.4 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-0.9.3 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-0.9.2 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-0.9.1 lib/agnostic_backend/queryable/result_set.rb
agnostic_backend-0.9.0 lib/agnostic_backend/queryable/result_set.rb