Sha256: 3aabd8082517fab11f4867946a620bc7e13a46f801d0f0fcc632c6c72e2845ef
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'active_support/core_ext/module/deprecation' module GearedPagination class Page attr_reader :recordset def initialize(portion, from:) @portion, @recordset = portion, from end def number @portion.page_number 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 before_last? number < recordset.page_count end def next_param @portion.next_param recordset.records end alias_method :next_number, :next_param if GearedPagination.rails_7_1? deprecate next_number: "use #next_param instead", deprecator: GearedPagination.deprecator else deprecate next_number: "use #next_param instead" 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-1.2.0 | lib/geared_pagination/page.rb |