Sha256: 15176c7edcb5421256ffb9e08d1cc3d3a2f801f3a2866f07e84a64deebe6a759
Contents?: true
Size: 440 Bytes
Versions: 12
Compression:
Stored size: 440 Bytes
Contents
# frozen_string_literal: true class DHS::Pagination::Offset < DHS::Pagination::Base DEFAULT_OFFSET = 0 def current_page (offset + limit) / limit end def next_offset(step = 1) self.class.next_offset(offset, limit, step) end def self.page_to_offset(page, limit = DEFAULT_LIMIT) (page.to_i - 1) * limit.to_i end def self.next_offset(offset, limit, step = 1) offset.to_i + limit.to_i * step.to_i end end
Version data entries
12 entries across 12 versions & 1 rubygems