Skip to content

Instantly share code, notes, and snippets.

@abrisse
Created June 27, 2012 10:04
Show Gist options
  • Save abrisse/3003094 to your computer and use it in GitHub Desktop.
Save abrisse/3003094 to your computer and use it in GitHub Desktop.
amq-protocol encode_properties should not try to encode nil values
def self.encode_properties(body_size, properties)
pieces, flags = [], 0
properties.each do |key, value|
if value
i, f, result = self.send(:"encode_#{key}", value)
flags |= f
pieces[i] = result
end
end
# result = [60, 0, body_size, flags].pack('n2Qn')
result = [60, 0].pack(PACK_UINT16_X2)
result += AMQ::Hacks.pack_64_big_endian(body_size)
result += [flags].pack(PACK_UINT16)
result + pieces.join(EMPTY_STRING)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment