Module: Facter::Util::Aix::InfoExtractor

Defined in:
lib/facter/util/aix/info_extractor.rb

Constant Summary collapse

MEGABYTES_EXPONENT =
1024**2
GIGABYTES_EXPONENT =
1024**3

Class Method Summary collapse

Class Method Details

.extract(content, regex) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/facter/util/aix/info_extractor.rb', line 10

def self.extract(content, regex)
  content = content.each_line.map do |line|
    next unless regex =~ line

    line.split(/:\s*|\s{2,}/)
  end

  content.flatten!.reject!(&:nil?)

  Hash[*content]
end