class Async::Container::Notify::Server

def self.load(message)

@returns [Hash] The parsed message.
@parameter message [String] The message to parse.

Parse a message, according to the `sd_notify` protocol.
def self.load(message)
	lines = message.split("\n")
	
	lines.pop if lines.last == ""
	
	pairs = lines.map do |line|
		key, value = line.split("=", 2)
		
		key = key.downcase.to_sym
		
		if value == "0"
			value = false
		elsif value == "1"
			value = true
		elsif key == :errno and value =~ /\A\-?\d+\z/
			value = Integer(value)
		end
		
		next [key, value]
	end
	
	return Hash[pairs]
end