amq-protocol 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6414473e47857ea1786e17fc043ccb0a7de1c51e
4
- data.tar.gz: 7e20dca497dd7b785a62fbf4f1edd8efde84ffda
3
+ metadata.gz: 592546ccd9dcc7fbaa136d8ba3b047cdf981e478
4
+ data.tar.gz: 269934dfff14063fcf9edc28bab301abadb28945
5
5
  SHA512:
6
- metadata.gz: bc68b493add7ea27adf4451631bd1137377e6f979feb43e834f48b8ab019688fdad5f726893bb1de9dbbc4a29948f47d4e7fcbd1607b3fea123f594e267fbd29
7
- data.tar.gz: ca3c1f251925c4bbee125e5b7556579129d00557847b79e797fb780f863bb18ff839f2f773e4e8aa339261f1ade985fdfb27402721dce4f15ca2ddc8cdb77bc3
6
+ metadata.gz: 00fe19339769feb0337e136f05124b0a1d71e70568a3673710285d40016cf5569ac87f41bcae036a837b8cb10c079cd9c95a86f956dddc4d0b9fb10630a8c1ed
7
+ data.tar.gz: f498ce739314be78b14f5679725a58edf9caa5e266514a3fcfbdd899cba7deedf7a584f06436f42d5023872dea9a32384274a6d59c52141e62cc7ed2c24cf3b8
data/README.md CHANGED
@@ -10,8 +10,7 @@ needs for you, including RabbitMQ extensions to AMQP 0.9.1.
10
10
  ## Supported Ruby Versions
11
11
 
12
12
  amq-protocol `1.9.2` was the last version to support Ruby 1.8 and 1.9.
13
-
14
- amq-protocol `2.0.0` and later will only support Ruby 2.0+.
13
+ amq-protocol `2.0.0` and later only supports Ruby 2.0+.
15
14
 
16
15
 
17
16
  ## Installation
@@ -1437,7 +1437,8 @@ module AMQ
1437
1437
  result = [60, 0].pack(PACK_UINT16_X2)
1438
1438
  result += AMQ::Pack.pack_uint64_big_endian(body_size)
1439
1439
  result += [flags].pack(PACK_UINT16)
1440
- result + pieces.join(EMPTY_STRING)
1440
+ pieces_joined = pieces.join(EMPTY_STRING)
1441
+ result.force_encoding(pieces_joined.encoding) + pieces_joined
1441
1442
  end
1442
1443
 
1443
1444
  # THIS DECODES ONLY FLAGS
@@ -41,11 +41,11 @@ module AMQ
41
41
  buffer << TYPE_HASH
42
42
  buffer << self.encode(value)
43
43
  else
44
- buffer << TableValueEncoder.encode(value)
44
+ buffer << TableValueEncoder.encode(value).force_encoding(buffer.encoding)
45
45
  end
46
46
  end
47
47
 
48
- [buffer.bytesize].pack(PACK_UINT32) + buffer
48
+ [buffer.bytesize].pack(PACK_UINT32).force_encoding(buffer.encoding) + buffer
49
49
  end
50
50
 
51
51
 
@@ -66,6 +66,12 @@ module AMQ
66
66
  when TYPE_STRING
67
67
  v, offset = TableValueDecoder.decode_string(data, offset)
68
68
  v
69
+ when TYPE_BYTE_ARRAY
70
+ # Ruby doesn't have a direct counterpart to
71
+ # ByteBuffer or byte[], so using a string feels
72
+ # more appropriate than an array of fixnums
73
+ v, offset = TableValueDecoder.decode_string(data, offset)
74
+ v
69
75
  when TYPE_INTEGER
70
76
  v, offset = TableValueDecoder.decode_integer(data, offset)
71
77
  v
@@ -35,6 +35,12 @@ module AMQ
35
35
  when TYPE_STRING
36
36
  v, offset = decode_string(data, offset)
37
37
  v
38
+ when TYPE_BYTE_ARRAY
39
+ # Ruby doesn't have a direct counterpart to
40
+ # ByteBuffer or byte[], so using a string feels
41
+ # more appropriate than an array of fixnums
42
+ v, offset = decode_string(data, offset)
43
+ v
38
44
  when TYPE_INTEGER
39
45
  v, offset = decode_integer(data, offset)
40
46
  v
@@ -1,5 +1,5 @@
1
1
  module AMQ
2
2
  module Protocol
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end # Protocol
5
5
  end # AMQ
@@ -93,6 +93,12 @@ module AMQ
93
93
  it "is capable of decoding string table values" do
94
94
  input = { "stringvalue" => "string" }
95
95
  expect(Table.decode(Table.encode(input))).to eq(input)
96
+
97
+ expect(Table.decode("\x00\x00\x00\x17\vstringvalueS\x00\x00\x00\x06string")).to eq(input)
98
+ end
99
+
100
+ it "is capable of decoding byte array table values (as Ruby strings)" do
101
+ expect(Table.decode("\x00\x00\x00\x17\vstringvaluex\x00\x00\x00\x06string")).to eq({"stringvalue" => "string"})
96
102
  end
97
103
 
98
104
  it "is capable of decoding string table values with UTF-8 characters" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amq-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Stastny
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-08-15 00:00:00.000000000 Z
14
+ date: 2015-12-17 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: |2
17
17
  amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not a