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


63
64
65
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 63

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


67
68
69
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 67

def page
  @page
end

#total_pagesObject (readonly)

Returns the value of attribute total_pages


67
68
69
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 67

def total_pages
  @total_pages
end

Instance Method Details

#next_pageObject


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

def next_page
  page + 1
end

#previous_pageObject


74
75
76
# File 'app/api/core/endpoint/basic_handler/paged.rb', line 74

def previous_page
  page - 1
end