Sha256: c03d8e9155d01be4e97d8b0a4b63ca74c74f107163e90c31b520cc9dfc9ded24
Contents?: true
Size: 737 Bytes
Versions: 1
Compression:
Stored size: 737 Bytes
Contents
require 'geared_pagination/portion' module GearedPagination class Page attr_reader :number, :recordset def initialize(number, from:) @number, @recordset = number, from @portion = GearedPagination::Portion.new(page_number: number, per_page: from.ratios) end def records @records ||= @portion.from(recordset.records) end def used? records.load.any? end def empty? records.load.none? end def first? number == 1 end def only? recordset.page_count == 1 end def last? number == recordset.page_count end def next_number number + 1 end def cache_key "page/#{@portion.cache_key}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geared_pagination-0.2 | lib/geared_pagination/page.rb |