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) ⇒ ArrayPaginator
constructor
A new instance of ArrayPaginator.
Methods inherited from Paginator
#==, #count, #each, #offset, #page, #size, #to_a
Constructor Details
#initialize(data) ⇒ ArrayPaginator
Returns a new instance of ArrayPaginator.
118 119 120 121 122 123 124 125 |
# File 'lib/ludy/paginator.rb', line 118 def initialize data @data = data super(lambda{ |offset, per_page| @data[offset, per_page] }, lambda{ @data.size }) end |
Instance Attribute Details
#data ⇒ Object (readonly)
data that you passed in this paginator
117 118 119 |
# File 'lib/ludy/paginator.rb', line 117 def data @data end |