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-2025 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(api, loog, repo) ⇒ Pulls

Returns a new instance of Pulls.



9
10
11
12
13
# File 'lib/mergem/pulls.rb', line 9

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

Instance Method Details

#eachObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/mergem/pulls.rb', line 15

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