Class: Qyu::Helpers::Pagination::PaginatableArray
- Inherits:
-
Array
- Object
- Array
- Qyu::Helpers::Pagination::PaginatableArray
- Defined in:
- lib/qyu/ui/helpers/pagination.rb
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.
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
#limit ⇒ Object
Returns the value of attribute limit.
7 8 9 |
# File 'lib/qyu/ui/helpers/pagination.rb', line 7 def limit @limit end |
#offset ⇒ Object
Returns the value of attribute offset.
7 8 9 |
# File 'lib/qyu/ui/helpers/pagination.rb', line 7 def offset @offset end |
#page ⇒ Object
Returns the value of attribute page.
7 8 9 |
# File 'lib/qyu/ui/helpers/pagination.rb', line 7 def page @page end |
#total_count ⇒ Object
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_pages ⇒ Object
17 18 19 |
# File 'lib/qyu/ui/helpers/pagination.rb', line 17 def total_pages @total_pages ||= total_count / limit end |