Class: Foreman::Utils

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

Class Method Summary collapse

Class Method Details

.parse_concurrency(concurrency) ⇒ Object



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

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