Decodes and returns the message's content.
# File lib/qpid_messaging/encoding.rb, line 30 def self.decode(message, content_type = nil) content_type = message.content_type if content_type.nil? case content_type when "amqp/map" return Cqpid.decodeMap message.message_impl when "amqp/list" return Cqpid.decodeList message.message_impl end message.content end
Encodes the supplied content into the given message.
# File lib/qpid_messaging/encoding.rb, line 25 def self.encode content, message, encoding = nil Cqpid::encode content, message.message_impl, encoding end
Takes as input any type and converts anything that's a symbol into a string.
# File lib/qpid_messaging/encoding.rb, line 45 def self.stringify(value) # set the default value result = value case value when Symbol result = value.to_s when Hash result = {} value.each_pair do |key, value| result[stringify(key)] = stringify(value) end when Array result = [] value.each do |element| result << stringify(element) end end return result end