Class: Split::DashboardPaginator
- Inherits:
-
Object
- Object
- Split::DashboardPaginator
- Defined in:
- lib/split/dashboard/paginator.rb
Instance Method Summary collapse
-
#initialize(collection, page_number, per) ⇒ DashboardPaginator
constructor
A new instance of DashboardPaginator.
- #paginate ⇒ Object
Constructor Details
#initialize(collection, page_number, per) ⇒ DashboardPaginator
Returns a new instance of DashboardPaginator.
4 5 6 7 8 |
# File 'lib/split/dashboard/paginator.rb', line 4 def initialize(collection, page_number, per) @collection = collection @page_number = page_number @per = per end |
Instance Method Details
#paginate ⇒ Object
10 11 12 13 14 |
# File 'lib/split/dashboard/paginator.rb', line 10 def paginate to = @page_number * @per from = to - @per @collection[from...to] end |