class DHS::Pagination::Start
Constants
- DEFAULT_OFFSET
Public Class Methods
next_offset(offset, limit, step = 1)
click to toggle source
# File lib/dhs/pagination/start.rb, line 19 def self.next_offset(offset, limit, step = 1) offset.to_i + limit.to_i * step.to_i end
page_to_offset(page, limit = DEFAULT_LIMIT)
click to toggle source
# File lib/dhs/pagination/start.rb, line 15 def self.page_to_offset(page, limit = DEFAULT_LIMIT) (page.to_i - 1) * limit.to_i + 1 end
Public Instance Methods
current_page()
click to toggle source
# File lib/dhs/pagination/start.rb, line 7 def current_page (offset + limit - 1) / limit end
next_offset(step = 1)
click to toggle source
# File lib/dhs/pagination/start.rb, line 11 def next_offset(step = 1) self.class.next_offset(offset, limit, step) end