Module: Facter::Util::Portage

Defined in:
lib/facter/util/portage.rb

Class Method Summary collapse

Class Method Details

.emerge_infoHash<Symbol, String>

Returns:

  • (Hash<Symbol, String>)


6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/facter/util/portage.rb', line 6

def emerge_info
  output = Facter::Util::Resolution.exec('emerge --info')

  values = output.scan(/[0-9A-Z_]+=".+?"/)

  hash = values.inject({}) do |hash, string|
    match = string.match(/(.*)="(.*)"/)
    key = match[1].downcase
    val = match[2]
    hash[key] = val
    hash
  end
end