class PackageConfig
def parse_pc
def parse_pc raise NotFoundError, ".pc doesn't exist: <#{@name}>" unless exist? @variables = {} @declarations = {} File.open(pc_path) do |input| input.each_line do |line| if line.dup.force_encoding("UTF-8").valid_encoding? line.force_encoding("UTF-8") end line = line.gsub(/#.*/, "").strip next if line.empty? case line when /^(#{IDENTIFIER_RE})\s*=\s*/ match = Regexp.last_match @variables[match[1]] = match.post_match.strip when /^(#{IDENTIFIER_RE})\s*:\s*/ match = Regexp.last_match @declarations[match[1]] = match.post_match.strip end end end end