Sha256: 3510672819bdb0e7ea54b8f14d21416cff7c30192dbd5ac9c27e749f03e4b37c

Contents?: true

Size: 461 Bytes

Versions: 2

Compression:

Stored size: 461 Bytes

Contents

module CursorPaginator
  module Paginator
    class Dynamoid < Base
      def paginate(scope)
        if options_parser.filter_required?
          cursor = scope.source.where(paginator_options.fetch(:primary_key) => options_parser.cursor).first
          return PaginationResult.new([], self) if cursor.blank?
        end

        records = scope.record_limit(page_size + 1).start(cursor)
        PaginationResult.new(records, self)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cursor_paginator-0.2.1 lib/cursor_paginator/paginator/dynamoid.rb
cursor_paginator-0.1.0 lib/cursor_paginator/paginator/dynamoid.rb