Class: SolidQueueMonitor::PaginationService

Inherits:
Object
  • Object
show all
Defined in:
app/services/solid_queue_monitor/pagination_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(relation, page, per_page) ⇒ PaginationService

Returns a new instance of PaginationService.



5
6
7
8
9
# File 'app/services/solid_queue_monitor/pagination_service.rb', line 5

def initialize(relation, page, per_page)
  @relation = relation
  @page = page
  @per_page = per_page
end

Instance Method Details

#paginateObject



11
12
13
14
15
16
17
# File 'app/services/solid_queue_monitor/pagination_service.rb', line 11

def paginate
  {
    records: paginated_records,
    total_pages: total_pages,
    current_page: @page
  }
end