class StableRedisPagination::Paginator

Attributes

index[R]

Public Class Methods

new(index) click to toggle source
# File lib/stable_redis_pagination/paginator.rb, line 6
def initialize(index)
  @index = index
end

Public Instance Methods

can_paginate?() click to toggle source
# File lib/stable_redis_pagination/paginator.rb, line 14
def can_paginate?
  StableRedisPagination.redis.exists(index)
end
paginate(**opts) click to toggle source
# File lib/stable_redis_pagination/paginator.rb, line 10
def paginate(**opts)
  range(**opts)
end
total_index_count() click to toggle source
# File lib/stable_redis_pagination/paginator.rb, line 18
def total_index_count
  StableRedisPagination.redis.zcard(index)
end

Private Instance Methods

range(order: 'asc', count: 20, after_id: nil) click to toggle source
# File lib/stable_redis_pagination/paginator.rb, line 24
def range(order: 'asc', count: 20, after_id: nil)
  Orderer.new(index, order, after_id, count).ordered_ids
end