Class: Michael::Services::Repositories

Inherits:
Object
  • Object
show all
Defined in:
lib/michael/services/repositories.rb

Instance Method Summary collapse

Constructor Details

#initialize(prs, threads = 5) ⇒ Repositories

Returns a new instance of Repositories.

Raises:



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