Class: HubLink::Stream

Inherits:
Object
  • Object
show all
Defined in:
lib/hub_link/stream.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo, since: nil) ⇒ Stream

Returns a new instance of Stream.



5
6
7
8
# File 'lib/hub_link/stream.rb', line 5

def initialize(repo, since: nil)
  @repo = repo
  @since = since&.to_date
end

Instance Method Details

#in_batches(&block) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/hub_link/stream.rb', line 10

def in_batches(&block)
  page = 1
  loop do
    batch = Batch.new(repo: repo, since: since, page: page)
    break if batch.empty?
    yield batch
    page += 1
  end
end