Class: Split::DashboardPaginator

Inherits:
Object
  • Object
show all
Defined in:
lib/split/dashboard/paginator.rb

Instance Method Summary collapse

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

#paginateObject



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