module Paginateable

Public Instance Methods

first_record() click to toggle source
# File lib/mas/paginateable.rb, line 16
def first_record
  return 1 if current_page == 1

  ((current_page - 1) * page_size) + 1
end
last_record() click to toggle source
# File lib/mas/paginateable.rb, line 22
def last_record
  last = current_page * page_size

  last > total_records ? total_records : last
end
limit_value()
Alias for: page_size
page_size() click to toggle source
# File lib/mas/paginateable.rb, line 28
def page_size
  MAS::RadCore::PAGE_SIZE
end
Also aliased as: limit_value
total_pages() click to toggle source
# File lib/mas/paginateable.rb, line 2
def total_pages
  if total_records < page_size
    1
  elsif (total_records % page_size).zero?
    total_records / page_size
  else
    (total_records / page_size) + 1
  end
end
total_records() click to toggle source
# File lib/mas/paginateable.rb, line 12
def total_records
  json['hits']['total']
end