Class: Pragma::Decorator::Pagination::Adapter::Base Abstract Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pragma/decorator/pagination/adapter/base.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is abstract.

Subclass and override the abstract methods to implement an adapter

This is the base pagination adapter.

Direct Known Subclasses

Kaminari, WillPaginate

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection) ⇒ Base

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes the adapter.

Parameters:

  • collection (Object)

    the collection to work with



20
21
22
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 20

def initialize(collection)
  @collection = collection
end

Instance Attribute Details

#collectionObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 15

def collection
  @collection
end

Instance Method Details

#current_pageInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the number of the current page.

Returns:

  • (Integer)

    the number of the current page



55
56
57
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 55

def current_page
  fail NotImplementedError
end

#next_pageInteger|NilClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the number of the next page, if any.

Returns:

  • (Integer|NilClass)

    the number of the next page, if any



62
63
64
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 62

def next_page
  fail NotImplementedError
end

#per_pageInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the number of entries per page in the collection.

Returns:

  • (Integer)

    the number of entries per page in the collection



34
35
36
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 34

def per_page
  fail NotImplementedError
end

#previous_pageInteger|NilClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the number of the previous page, if any.

Returns:

  • (Integer|NilClass)

    the number of the previous page, if any



48
49
50
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 48

def previous_page
  fail NotImplementedError
end

#total_entriesInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the total number of entries in the collection.

Returns:

  • (Integer)

    the total number of entries in the collection



27
28
29
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 27

def total_entries
  fail NotImplementedError
end

#total_pagesInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the total number of pages in the collection.

Returns:

  • (Integer)

    the total number of pages in the collection



41
42
43
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 41

def total_pages
  fail NotImplementedError
end