Sha256: 064935b0e66d2b056f1ab2bd717deeab7743a8f16aa964c66c785848853e09ab
Contents?: true
Size: 534 Bytes
Versions: 1
Compression:
Stored size: 534 Bytes
Contents
# Pagination Logic for Ruby. # === by John Ankarström === # http://jocap.github.com/Ruby-Pagination-Logic # See LICENSE.txt. class 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.0.0 | lib/ruby_pagination_logic.rb |