Class: Ludy::ArrayPaginator
- Defined in:
- lib/ludy/paginator.rb
Overview
array paginator would just simply assume your data is an array, and create pages simply for your_data[offset, per_page] if your data is much more complex, use Paginator instead of this
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
data that you passed in this paginator.
Attributes inherited from Paginator
Instance Method Summary collapse
-
#initialize(data, per_page = 20) ⇒ ArrayPaginator
constructor
A new instance of ArrayPaginator.
Methods inherited from Paginator
#==, #count, #each, null, #offset, #page, #size, #to_a
Constructor Details
#initialize(data, per_page = 20) ⇒ ArrayPaginator
Returns a new instance of ArrayPaginator.
124 125 126 127 128 129 130 131 |
# File 'lib/ludy/paginator.rb', line 124 def initialize data, per_page = 20 @data = data super(lambda{ |offset, per_page| @data[offset, per_page] }, lambda{ @data.size }, per_page) end |
Instance Attribute Details
#data ⇒ Object (readonly)
data that you passed in this paginator
123 124 125 |
# File 'lib/ludy/paginator.rb', line 123 def data @data end |