module LegacyFacter::Util::Parser::KeyValuePairOutputFormat

Public Class Methods

parse(output) click to toggle source
# File lib/facter/custom_facts/util/parser.rb, line 80
def self.parse(output)
  return {} if output.nil?

  result = {}
  re = /^(.+?)=(.+)$/
  output.each_line do |line|
    if (match_data = re.match(line.chomp))
      result[match_data[1]] = match_data[2]
    end
  end
  result
end