Class: HubLink::Stream

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

Instance Method Summary collapse

Constructor Details

#initialize(repo, start_date: nil, batch_size: 7) ⇒ Stream

Returns a new instance of Stream.



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

def initialize(repo, start_date: nil, batch_size: 7)
  @repo = repo
  @start_date = (start_date || date_of_first_pr).to_date
  @batch_size = batch_size
end

Instance Method Details

#in_batches(&block) ⇒ Object



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

def in_batches(&block)
  start_date.step(end_date, batch_size) do |date|
    range = "#{date}..#{date + (batch_size - 1)}"
    yield Batch.new "type:pr updated:#{range} repo:#{repo}"
  end
end