Class: Bitbucket::Paginator

Inherits:
Object
  • Object
show all
Defined in:
lib/bitbucket/paginator.rb

Constant Summary collapse

PAGE_LENGTH =

The minimum length is 10 and the maximum is 100.

50

Instance Method Summary collapse

Constructor Details

#initialize(connection, url, type) ⇒ Paginator

Returns a new instance of Paginator.


7
8
9
10
11
12
# File 'lib/bitbucket/paginator.rb', line 7

def initialize(connection, url, type)
  @connection = connection
  @type = type
  @url = url
  @page = nil
end

Instance Method Details

#itemsObject

Raises:

  • (StopIteration)

14
15
16
17
18
19
# File 'lib/bitbucket/paginator.rb', line 14

def items
  raise StopIteration unless has_next_page?

  @page = fetch_next_page
  @page.items
end