Class: ActiveItem::Pagination::PaginatedResult
- Inherits:
-
Object
- Object
- ActiveItem::Pagination::PaginatedResult
- Includes:
- Enumerable
- Defined in:
- lib/active_item/pagination.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#next_cursor ⇒ Object
readonly
Returns the value of attribute next_cursor.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #has_more? ⇒ Boolean
-
#initialize(items:, next_cursor:, per_page:) ⇒ PaginatedResult
constructor
A new instance of PaginatedResult.
- #length ⇒ Object (also: #size, #count)
- #pagination_metadata ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(items:, next_cursor:, per_page:) ⇒ PaginatedResult
Returns a new instance of PaginatedResult.
29 30 31 32 33 |
# File 'lib/active_item/pagination.rb', line 29 def initialize(items:, next_cursor:, per_page:) @items = items @next_cursor = next_cursor @per_page = per_page end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
27 28 29 |
# File 'lib/active_item/pagination.rb', line 27 def items @items end |
#next_cursor ⇒ Object (readonly)
Returns the value of attribute next_cursor.
27 28 29 |
# File 'lib/active_item/pagination.rb', line 27 def next_cursor @next_cursor end |
#per_page ⇒ Object (readonly)
Returns the value of attribute per_page.
27 28 29 |
# File 'lib/active_item/pagination.rb', line 27 def per_page @per_page end |
Instance Method Details
#each(&block) ⇒ Object
43 |
# File 'lib/active_item/pagination.rb', line 43 def each(&block) = items.each(&block) |
#empty? ⇒ Boolean
47 |
# File 'lib/active_item/pagination.rb', line 47 def empty? = items.empty? |
#has_more? ⇒ Boolean
35 36 37 |
# File 'lib/active_item/pagination.rb', line 35 def has_more? !next_cursor.nil? end |
#length ⇒ Object Also known as: size, count
44 |
# File 'lib/active_item/pagination.rb', line 44 def length = items.length |
#pagination_metadata ⇒ Object
39 40 41 |
# File 'lib/active_item/pagination.rb', line 39 def { next_cursor: next_cursor, has_more: has_more?, per_page: per_page } end |
#to_a ⇒ Object
48 |
# File 'lib/active_item/pagination.rb', line 48 def to_a = items |