module RPL

jocap.github.com/Ruby-Pagination-Logic See LICENSE.txt.

Public Class Methods

next(page) click to toggle source
# File lib/ruby_pagination_logic.rb, line 18
def self.next(page)
  begin
    return page + 1
  rescue NoMethodError => e
    return false
  end
end
paginate(page = 1, limit = 10) click to toggle source
# File lib/ruby_pagination_logic.rb, line 9
def self.paginate(page = 1, limit = 10)
  if page > 1
    offset = limit * (page - 1)
    return offset
  else
    return 0
  end
end
prev(page) click to toggle source
# File lib/ruby_pagination_logic.rb, line 26
def self.prev(page)
  begin
    return page - 1
  rescue NoMethodError => e
    return false
  end
end