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.



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

#paginateObject



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