Class: Gearhead::Paginators::Paginator
- Inherits:
-
Object
- Object
- Gearhead::Paginators::Paginator
- Defined in:
- lib/gearhead/paginators/paginator.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(records, action) ⇒ Paginator
constructor
A new instance of Paginator.
-
#paginate ⇒ Object
should set @collection.
- #serialization_options ⇒ Object
Constructor Details
#initialize(records, action) ⇒ Paginator
Returns a new instance of Paginator.
9 10 11 12 13 |
# File 'lib/gearhead/paginators/paginator.rb', line 9 def initialize(records, action) @records = records @collection = nil @action = action end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
8 9 10 |
# File 'lib/gearhead/paginators/paginator.rb', line 8 def collection @collection end |
Class Method Details
.paginate(records, action) ⇒ Object
4 5 6 |
# File 'lib/gearhead/paginators/paginator.rb', line 4 def self.paginate(records, action) ::Gearhead::Paginators::Lookup.for(action).new(records, action) end |
Instance Method Details
#call ⇒ Object
20 21 22 23 |
# File 'lib/gearhead/paginators/paginator.rb', line 20 def call paginate self end |
#paginate ⇒ Object
should set @collection
16 17 18 |
# File 'lib/gearhead/paginators/paginator.rb', line 16 def paginate raise NotImplementedError, "define paginate and set @collection" end |
#serialization_options ⇒ Object
25 26 27 |
# File 'lib/gearhead/paginators/paginator.rb', line 25 def {} end |