Class: Qyu::Helpers::Pagination::PaginatableArray
- Inherits:
-
Array
- Object
- Array
- Qyu::Helpers::Pagination::PaginatableArray
- Defined in:
- lib/qyu/ui/helpers/pagination.rb
Overview
Qyu::Helpers::Pagination::PaginatableArray
Instance Attribute Summary collapse
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#page ⇒ Object
Returns the value of attribute page.
-
#total_count ⇒ Object
Returns the value of attribute total_count.
Instance Method Summary collapse
-
#initialize(collection, limit:, offset:, total_count:, page:) ⇒ PaginatableArray
constructor
A new instance of PaginatableArray.
- #total_pages ⇒ Object
Constructor Details
#initialize(collection, limit:, offset:, total_count:, page:) ⇒ PaginatableArray
Returns a new instance of 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
#limit ⇒ Object
Returns the value of attribute limit.
8 9 10 |
# File 'lib/qyu/ui/helpers/pagination.rb', line 8 def limit @limit end |
#offset ⇒ Object
Returns the value of attribute offset.
8 9 10 |
# File 'lib/qyu/ui/helpers/pagination.rb', line 8 def offset @offset end |
#page ⇒ Object
Returns the value of attribute page.
8 9 10 |
# File 'lib/qyu/ui/helpers/pagination.rb', line 8 def page @page end |
#total_count ⇒ Object
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_pages ⇒ Object
18 19 20 |
# File 'lib/qyu/ui/helpers/pagination.rb', line 18 def total_pages @total_pages ||= total_count / limit end |