Class: SnapCi::ProjectList

Inherits:
Object
  • Object
show all
Defined in:
lib/snap_ci/project_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ ProjectList

Returns a new instance of ProjectList.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/snap_ci/project_list.rb', line 7

def initialize(args)
  @list = []
  mutex = Mutex.new

  args.projects.map do |project_info|
    Thread.new do
      project_message = Project.new(project_info, args).to_message
      mutex.synchronize { @list << project_message }
    end
  end.each(&:join)
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



5
6
7
# File 'lib/snap_ci/project_list.rb', line 5

def list
  @list
end

Instance Method Details

#to_messageObject



19
20
21
# File 'lib/snap_ci/project_list.rb', line 19

def to_message
  list.join("\n\n")
end