Class: Sink::PageCursorURL

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataArray

Returns:

  • (Array)


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

def data
  @data
end

#next_pageSink::PageCursorURL

Returns:

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/sink/page_cursor_url.rb', line 9

def next_page
  @next_page
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_url.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.data.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_url.rb', line 47

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

#next_page?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/sink/page_cursor_url.rb', line 24

def next_page?
  raise NotImplementedError
end