class Middleman::Paginate::Extension::Pager
Attributes
current_page[R]
per_page[R]
total_pages[R]
Public Class Methods
new(base_path, suffix, current_page, total_pages, per_page)
click to toggle source
# File lib/middleman/paginate/extension.rb, line 21 def initialize(base_path, suffix, current_page, total_pages, per_page) @base_path = base_path @suffix = suffix @current_page = current_page @total_pages = total_pages @per_page = per_page end
Public Instance Methods
full_page_path(page = current_page)
click to toggle source
# File lib/middleman/paginate/extension.rb, line 37 def full_page_path(page = current_page) "#{@base_path}#{page == 1 ? '/index' : @suffix.gsub(/:num/, page.to_s)}.html" end
next_page()
click to toggle source
# File lib/middleman/paginate/extension.rb, line 29 def next_page current_page < total_pages && current_page + 1 end
page_path(page = current_page)
click to toggle source
# File lib/middleman/paginate/extension.rb, line 41 def page_path(page = current_page) full_path = full_page_path(page) if full_path.end_with?("/index.html") full_path.gsub(/index\.html$/, '') else full_path end end
previous_page()
click to toggle source
# File lib/middleman/paginate/extension.rb, line 33 def previous_page current_page > 1 && current_page - 1 end