Class: PagingObject

Inherits:
Object
  • Object
show all
Defined in:
lib/paging_object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(total_pages, current_page, per_page, total) ⇒ PagingObject

Returns a new instance of PagingObject.


4
5
6
7
8
9
10
# File 'lib/paging_object.rb', line 4

def initialize(total_pages, current_page, per_page, total)
	@total_pages = total_pages.to_i
	@current_page = current_page.to_i
	@current_page ||= 1
	@per_page = per_page.to_i
	@total_entries = total.to_i if total
end

Instance Attribute Details

#current_pageObject (readonly)

Returns the value of attribute current_page


2
3
4
# File 'lib/paging_object.rb', line 2

def current_page
  @current_page
end

#per_pageObject (readonly)

Returns the value of attribute per_page


2
3
4
# File 'lib/paging_object.rb', line 2

def per_page
  @per_page
end

#total_entriesObject (readonly)

Returns the value of attribute total_entries


2
3
4
# File 'lib/paging_object.rb', line 2

def total_entries
  @total_entries
end

#total_pagesObject (readonly)

Returns the value of attribute total_pages


2
3
4
# File 'lib/paging_object.rb', line 2

def total_pages
  @total_pages
end