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.
5 6 7 8 9 |
# File 'lib/split/dashboard/paginator.rb', line 5 def initialize(collection, page_number, per) @collection = collection @page_number = page_number @per = per end |
Instance Method Details
#paginate ⇒ Object
11 12 13 14 15 |
# File 'lib/split/dashboard/paginator.rb', line 11 def paginate to = @page_number * @per from = to - @per @collection[from...to] end |