Sha256: ad720376262f0e1d80f025a7640d92e3240bcc8287e1bec6c16c69cdaced3324

Contents?: true

Size: 426 Bytes

Versions: 5

Compression:

Stored size: 426 Bytes

Contents

# frozen_string_literal: true

module Tikkie
  module Api
    module Responses
      # Helper for paginated responses.
      module Pagination
        attr_accessor :offset, :limit, :elements, :total_elements

        def more_elements?
          @total_elements && @total_elements > @offset + @elements
        end

        def next_offset
          @offset + @limit if more_elements?
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tikkie-api-0.2.2 lib/tikkie/api/responses/pagination.rb
tikkie-api-0.2.1 lib/tikkie/api/responses/pagination.rb
tikkie-api-0.2.0 lib/tikkie/api/responses/pagination.rb
tikkie-api-0.1.1 lib/tikkie/api/responses/pagination.rb
tikkie-api-0.1.0 lib/tikkie/api/responses/pagination.rb