Sha256: 998bd558af0a6295d77534aa2f074f39c5fd2c115b841b87fd1e0ba691521987

Contents?: true

Size: 472 Bytes

Versions: 1

Compression:

Stored size: 472 Bytes

Contents

# frozen_string_literal: true

module Tikkie
  module Api
    module V1
      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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tikkie-api-2.0.0 lib/tikkie/api/v1/responses/pagination.rb