Class: Locomotive::Coal::PaginatedResources

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/locomotive/coal/paginated_resources.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list, page, total_pages, total_entries) ⇒ PaginatedResources

Returns a new instance of PaginatedResources.



7
8
9
10
# File 'lib/locomotive/coal/paginated_resources.rb', line 7

def initialize(list, page, total_pages, total_entries)
  @_page, @_total_pages, @_total_entries = page, total_pages, total_entries
  super(list)
end

Instance Attribute Details

#_pageObject

Returns the value of attribute _page.



5
6
7
# File 'lib/locomotive/coal/paginated_resources.rb', line 5

def _page
  @_page
end

#_total_entriesObject

Returns the value of attribute _total_entries.



5
6
7
# File 'lib/locomotive/coal/paginated_resources.rb', line 5

def _total_entries
  @_total_entries
end

#_total_pagesObject

Returns the value of attribute _total_pages.



5
6
7
# File 'lib/locomotive/coal/paginated_resources.rb', line 5

def _total_pages
  @_total_pages
end

Instance Method Details

#_next_pageObject



12
13
14
15
16
# File 'lib/locomotive/coal/paginated_resources.rb', line 12

def _next_page
  if @_page < @_total_pages
    @_page + 1
  end
end