Class: Qyu::Helpers::Pagination::PaginatableArray

Inherits:
Array
  • Object
show all
Defined in:
lib/qyu/ui/helpers/pagination.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection, limit:, offset:, total_count:, page:) ⇒ PaginatableArray

Returns a new instance of PaginatableArray.



9
10
11
12
13
14
15
# File 'lib/qyu/ui/helpers/pagination.rb', line 9

def initialize(collection, limit:, offset:, total_count:, page:)
  @limit = limit
  @offset = offset
  @total_count = total_count
  @page = page
  super(collection)
end

Instance Attribute Details

#limitObject

Returns the value of attribute limit.



7
8
9
# File 'lib/qyu/ui/helpers/pagination.rb', line 7

def limit
  @limit
end

#offsetObject

Returns the value of attribute offset.



7
8
9
# File 'lib/qyu/ui/helpers/pagination.rb', line 7

def offset
  @offset
end

#pageObject

Returns the value of attribute page.



7
8
9
# File 'lib/qyu/ui/helpers/pagination.rb', line 7

def page
  @page
end

#total_countObject

Returns the value of attribute total_count.



7
8
9
# File 'lib/qyu/ui/helpers/pagination.rb', line 7

def total_count
  @total_count
end

Instance Method Details

#total_pagesObject



17
18
19
# File 'lib/qyu/ui/helpers/pagination.rb', line 17

def total_pages
  @total_pages ||= total_count / limit
end