Class: Sink::PageCursorTopLevelArray

Inherits:
Array
  • Object
show all
Defined in:
lib/sink/page_cursor_top_level_array.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#my_cursorString

Returns:

  • (String)


6
7
8
# File 'lib/sink/page_cursor_top_level_array.rb', line 6

def my_cursor
  @my_cursor
end

Instance Method Details

#auto_paging_each(&blk) ⇒ nil

Returns:

  • (nil)


34
35
36
37
38
39
40
41
42
43
44
# File 'lib/sink/page_cursor_top_level_array.rb', line 34

def auto_paging_each(&blk)
  if !blk
    raise "A block must be given to #auto_paging_each"
  end
  page = self
  loop do
    page.each { |e| blk.call(e) }
    break if !page.next_page?
    page = page.next_page
  end
end

#inspectObject

Returns String.

Returns:

  • String



47
48
49
# File 'lib/sink/page_cursor_top_level_array.rb', line 47

def inspect
  "#<#{selfl.class}:0x#{object_id.to_s(16)} my_cursor=#{my_cursor.inspect}>"
end

#next_pageSink::PageCursorTopLevelArray



26
27
28
29
30
31
# File 'lib/sink/page_cursor_top_level_array.rb', line 26

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: my_cursor}}), opts)
end

#next_page?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/sink/page_cursor_top_level_array.rb', line 21

def next_page?
  !my_cursor.nil?
end