Class: Pragma::Decorator::Pagination::Adapter::Base Abstract Private
- Inherits:
-
Object
- Object
- Pragma::Decorator::Pagination::Adapter::Base
- 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.
Subclass and override the abstract methods to implement an adapter
This is the base pagination adapter.
Direct Known Subclasses
Instance Attribute Summary collapse
- #collection ⇒ Object readonly private
Instance Method Summary collapse
-
#current_page ⇒ Integer
private
Returns the number of the current page.
-
#initialize(collection) ⇒ Base
constructor
private
Initializes the adapter.
-
#next_page ⇒ Integer|NilClass
private
Returns the number of the next page, if any.
-
#per_page ⇒ Integer
private
Returns the number of entries per page in the collection.
-
#previous_page ⇒ Integer|NilClass
private
Returns the number of the previous page, if any.
-
#total_entries ⇒ Integer
private
Returns the total number of entries in the collection.
-
#total_pages ⇒ Integer
private
Returns the total number of pages in the collection.
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.
20 21 22 |
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 20 def initialize(collection) @collection = collection end |
Instance Attribute Details
#collection ⇒ Object (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_page ⇒ Integer
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.
55 56 57 |
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 55 def current_page fail NotImplementedError end |
#next_page ⇒ Integer|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.
62 63 64 |
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 62 def next_page fail NotImplementedError end |
#per_page ⇒ Integer
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.
34 35 36 |
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 34 def per_page fail NotImplementedError end |
#previous_page ⇒ Integer|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.
48 49 50 |
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 48 def previous_page fail NotImplementedError end |
#total_entries ⇒ Integer
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.
27 28 29 |
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 27 def total_entries fail NotImplementedError end |
#total_pages ⇒ Integer
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.
41 42 43 |
# File 'lib/pragma/decorator/pagination/adapter/base.rb', line 41 def total_pages fail NotImplementedError end |