Class: Core::Endpoint::BasicHandler::Paged::PagedTarget::PageOfResults

Inherits:
Object
  • Object
show all
Defined in:
app/api/core/endpoint/basic_handler/paged.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page, _total, per_page) ⇒ PageOfResults

Returns a new instance of PageOfResults.



65
66
67
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 65

def initialize(page, _total, per_page)
  @page, @total_pages = page, page / per_page
end

Instance Attribute Details

#pageObject (readonly) Also known as: current_page

Returns the value of attribute page.



69
70
71
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 69

def page
  @page
end

#total_pagesObject (readonly)

Returns the value of attribute total_pages.



69
70
71
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 69

def total_pages
  @total_pages
end

Instance Method Details

#next_pageObject



72
73
74
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 72

def next_page
  page + 1
end

#previous_pageObject



76
77
78
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 76

def previous_page
  page - 1
end