class Que::Web::Pager

Attributes

current_page[R]
page_count[R]
page_size[R]
total[R]

Public Class Methods

new(page_no, page_size, total) click to toggle source
# File lib/que/web/pager.rb, line 4
def initialize(page_no, page_size, total)
  @current_page = page_no > 1 ? page_no : 1
  @page_size = page_size
  @total = total

  @page_count = total > 0 ? (total / page_size.to_f).ceil : 1
end

Public Instance Methods

next_page() click to toggle source
# File lib/que/web/pager.rb, line 12
def next_page
  @current_page < @page_count ? (@current_page + 1) : nil
end
offset() click to toggle source
# File lib/que/web/pager.rb, line 20
def offset
  (@current_page - 1) * @page_size
end
prev_page() click to toggle source
# File lib/que/web/pager.rb, line 16
def prev_page
  @current_page > 1 ? (@current_page - 1) : nil
end