Sha256: 363741218e64adb91efe0b654abce395f5ae7c4486476d249f25dbf5fd362001
Contents?: true
Size: 508 Bytes
Versions: 22
Compression:
Stored size: 508 Bytes
Contents
class Que::Web::Pager attr_reader :current_page, :page_size, :total, :page_count 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 def next_page @current_page < @page_count ? (@current_page + 1) : nil end def prev_page @current_page > 1 ? (@current_page - 1) : nil end def offset (@current_page - 1) * @page_size end end
Version data entries
22 entries across 22 versions & 1 rubygems