class Hanami::Pagination::MockPager
Attributes
current_page[R]
total_pages[R]
Public Class Methods
new(current_page, total_pages)
click to toggle source
# File lib/hanami/pagination/mock_pager.rb, line 6 def initialize(current_page, total_pages) @current_page = current_page @total_pages = total_pages end
Public Instance Methods
first_page?()
click to toggle source
# File lib/hanami/pagination/mock_pager.rb, line 27 def first_page? current_page == 1 end
last_page?()
click to toggle source
# File lib/hanami/pagination/mock_pager.rb, line 31 def last_page? current_page == total_pages end
next_page()
click to toggle source
# File lib/hanami/pagination/mock_pager.rb, line 11 def next_page [current_page + 1, total_pages].min end
prev_page()
click to toggle source
# File lib/hanami/pagination/mock_pager.rb, line 15 def prev_page [current_page - 1, 1].max end
total()
click to toggle source
# File lib/hanami/pagination/mock_pager.rb, line 19 def total total_pages end