Class: Sink::PageCursorSharedRef
- Inherits:
-
Object
- Object
- Sink::PageCursorSharedRef
show all
- Defined in:
- lib/sink/page_cursor_shared_ref.rb
Defined Under Namespace
Classes: PageCursorSharedRefPagination
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
24
25
26
|
# File 'lib/sink/page_cursor_shared_ref.rb', line 24
def data
@data
end
|
27
28
29
|
# File 'lib/sink/page_cursor_shared_ref.rb', line 27
def
@pagination
end
|
Instance Method Details
permalink
#auto_paging_each(&blk) ⇒ nil
[View source]
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/sink/page_cursor_shared_ref.rb', line 55
def auto_paging_each(&blk)
if !blk
raise "A block must be given to #auto_paging_each"
end
page = self
loop do
page.data.each { |e| blk.call(e) }
break if !page.next_page?
page = page.next_page
end
end
|
[View source]
68
69
70
|
# File 'lib/sink/page_cursor_shared_ref.rb', line 68
def inspect
"#<#{selfl.class}:0x#{object_id.to_s(16)} data=#{data.inspect} pagination=#{.inspect}>"
end
|
[View source]
47
48
49
50
51
52
|
# File 'lib/sink/page_cursor_shared_ref.rb', line 47
def next_page
if !next_page?
raise "No more pages available; please check #next_page? before calling #next_page"
end
client.request(Util.deep_merge(req, {query: {cursor: cursor}}), opts)
end
|
permalink
#next_page? ⇒ Boolean
[View source]
42
43
44
|
# File 'lib/sink/page_cursor_shared_ref.rb', line 42
def next_page?
!.cursor.nil?
end
|