Module: RPL
- Defined in:
- lib/ruby_pagination_logic.rb
Overview
jocap.github.com/Ruby-Pagination-Logic See LICENSE.txt.
Class Method Summary collapse
Class Method Details
.next(page) ⇒ Object
18 19 20 21 22 23 24 |
# 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) ⇒ Object
9 10 11 12 13 14 15 16 |
# 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) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/ruby_pagination_logic.rb', line 26 def self.prev(page) begin return page - 1 rescue NoMethodError => e return false end end |