Created
June 27, 2012 10:04
-
-
Save abrisse/3003094 to your computer and use it in GitHub Desktop.
amq-protocol encode_properties should not try to encode nil values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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