Class: Michael::Services::Repositories
- Inherits:
-
Object
- Object
- Michael::Services::Repositories
- Defined in:
- lib/michael/services/repositories.rb
Instance Method Summary collapse
-
#initialize(prs, threads = 5) ⇒ Repositories
constructor
A new instance of Repositories.
- #pull_requests(org_repos_list, queue = nil, params = {}) ⇒ Object
Constructor Details
#initialize(prs, threads = 5) ⇒ Repositories
Returns a new instance of Repositories.
10 11 12 13 14 15 |
# File 'lib/michael/services/repositories.rb', line 10 def initialize(prs, threads = 5) raise Fatal, 'uninitialized prs' if prs.nil? @prs = prs @threads = threads end |
Instance Method Details
#pull_requests(org_repos_list, queue = nil, params = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/michael/services/repositories.rb', line 17 def pull_requests(org_repos_list, queue = nil, params = {}) repos = Parallel.map(org_repos_list, in_threads: threads) do |org_repo| queue << org_repo unless queue.nil? list = prs.search(org_repo, params) Michael::Models::Repository.new(org_repo, prs: list) end queue&.close repos end |