class RedisPagination::Paginator::NonePaginator

Public Class Methods

new(key, options = {}) click to toggle source

Initialize a new instance with a given Redis key and options.

@param key [String] Redis key. @param options [Hash] Options for paginator.

# File lib/redis_pagination/paginator/none_paginator.rb, line 8
def initialize(key, options = {})
end

Public Instance Methods

all(options = {}) click to toggle source

Retrieve all items for key.

@return a Hash containing :current_page, :total_pages, :total_items and :items.

# File lib/redis_pagination/paginator/none_paginator.rb, line 48
def all(options = {})
  {
    :current_page => 1,
    :total_pages => 0,
    :total_items => 0,
    :items => []
  }
end
page(page, options = {}) click to toggle source

Retrieve a page of items for key.

@param page [int] Page of items to retrieve. @param options [Hash] Options. Valid options are :page_size.

:page_size controls the page size for the call. Default is +RedisPagination.page_size+.

@return a Hash containing :current_page, :total_pages, :total_items and :items.

# File lib/redis_pagination/paginator/none_paginator.rb, line 34
def page(page, options = {})
  current_page = page < 1 ? 1 : page

  {
    :current_page => current_page,
    :total_pages => 0,
    :total_items => 0,
    :items => []
  }
end
total_items() click to toggle source

Return the total number of items for key.

@return the total number of items for key.

# File lib/redis_pagination/paginator/none_paginator.rb, line 23
def total_items
  0
end
total_pages(page_size = RedisPagination.page_size) click to toggle source

Return the total number of pages for key.

@param page_size [int] Page size to calculate total number of pages.

@return the total number of pages for key.

# File lib/redis_pagination/paginator/none_paginator.rb, line 16
def total_pages(page_size = RedisPagination.page_size)
  0
end