Class: Mergem::Pulls

Inherits:
Object
  • Object
show all
Defined in:
lib/mergem/pulls.rb

Overview

Pulls in GitHub API.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2022-2023 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(api, loog, repo) ⇒ Pulls

Returns a new instance of Pulls.



26
27
28
29
30
# File 'lib/mergem/pulls.rb', line 26

def initialize(api, loog, repo)
  @api = api
  @loog = loog
  @repo = repo
end

Instance Method Details

#eachObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/mergem/pulls.rb', line 32

def each
  json = @api.pull_requests(@repo, state: 'open')
  @loog.debug("Found #{json.count} pull requests in #{@repo}")
  total = 0
  json.each do |p|
    yield p[:number]
    total += 1
  end
  total
end