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

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

Overview

Qyu::Helpers::Pagination::PaginatableArray

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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


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

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


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

def limit
  @limit
end

#offsetObject

Returns the value of attribute offset


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

def offset
  @offset
end

#pageObject

Returns the value of attribute page


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

def page
  @page
end

#total_countObject

Returns the value of attribute total_count


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

def total_count
  @total_count
end

Instance Method Details

#total_pagesObject


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

def total_pages
  @total_pages ||= total_count / limit
end