class GearedPagination::Page

Attributes

recordset[R]

Public Class Methods

new(portion, from:) click to toggle source
# File lib/geared_pagination/page.rb, line 7
def initialize(portion, from:)
  @portion, @recordset = portion, from
end

Public Instance Methods

before_last?() click to toggle source
# File lib/geared_pagination/page.rb, line 41
def before_last?
  number < recordset.page_count
end
cache_key() click to toggle source
# File lib/geared_pagination/page.rb, line 54
def cache_key
  "page/#{@portion.cache_key}"
end
empty?() click to toggle source
# File lib/geared_pagination/page.rb, line 24
def empty?
  records.load.none?
end
first?() click to toggle source
# File lib/geared_pagination/page.rb, line 29
def first?
  number == 1
end
last?() click to toggle source
# File lib/geared_pagination/page.rb, line 37
def last?
  number == recordset.page_count
end
next_number()
Alias for: next_param
next_param() click to toggle source
# File lib/geared_pagination/page.rb, line 46
def next_param
  @portion.next_param recordset.records
end
Also aliased as: next_number
number() click to toggle source
# File lib/geared_pagination/page.rb, line 11
def number
  @portion.page_number
end
only?() click to toggle source
# File lib/geared_pagination/page.rb, line 33
def only?
  recordset.page_count == 1
end
records() click to toggle source
# File lib/geared_pagination/page.rb, line 15
def records
  @records ||= @portion.from(recordset.records)
end
used?() click to toggle source
# File lib/geared_pagination/page.rb, line 20
def used?
  records.load.any?
end