class Wor::Paginate::Adapters::Base
Attributes
page[R]
Public Class Methods
new(content, page, limit)
click to toggle source
# File lib/wor/paginate/adapters/base.rb, line 7 def initialize(content, page, limit) @content = content @page = page.to_i @limit = limit.to_i raise Wor::Paginate::Exceptions::InvalidPageNumber if @page <= 0 raise Wor::Paginate::Exceptions::InvalidLimitNumber if @limit <= 0 end
Public Instance Methods
adapt?()
click to toggle source
# File lib/wor/paginate/adapters/base.rb, line 15 def adapt? required_methods.all? { |method| @content.respond_to? method } end
next_page()
click to toggle source
# File lib/wor/paginate/adapters/base.rb, line 25 def next_page return nil if page >= total_pages page + 1 end
previous_page()
click to toggle source
# File lib/wor/paginate/adapters/base.rb, line 31 def previous_page return nil if page == 1 page - 1 end