Sha256: da5364211a15dfae6b896e18d928162b805d984d3dc573c7ddc9e58281093c9b
Contents?: true
Size: 535 Bytes
Versions: 1
Compression:
Stored size: 535 Bytes
Contents
# Pagination Logic for Ruby. # === by John Ankarström === # http://jocap.github.com/Ruby-Pagination-Logic # See LICENSE.txt. module RPL def self.paginate(page = 1, limit = 10) if page > 1 offset = limit * (page - 1) return offset else return 0 end end def self.next(page) begin return page + 1 rescue NoMethodError => e return false end end def self.prev(page) begin return page - 1 rescue NoMethodError => e return false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby_pagination_logic-0.1.0 | lib/ruby_pagination_logic.rb |