Class: Foreman::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/foreman/utils.rb

Class Method Summary collapse

Class Method Details

.parse_concurrency(concurrency, min = 1) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/foreman/utils.rb', line 5

def self.parse_concurrency(concurrency, min=1)
  @concurrency ||= begin
    pairs = concurrency.to_s.gsub(/\s/, "").split(",")
    pairs.inject(Hash.new(min)) do |hash, pair|
      process, amount = pair.split("=")
      hash.update(process => (amount || 1).to_i)
    end
  end
end