amq-protocol 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +3 -2
- data/lib/amq/hacks.rb +2 -2
- data/lib/amq/protocol/version.rb +1 -1
- data/spec/amq/hacks_spec.rb +30 -9
- data/spec/amq/protocol/table_spec.rb +2 -2
- metadata +4 -4
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/lib/amq/hacks.rb
CHANGED
@@ -18,11 +18,11 @@ module AMQ
|
|
18
18
|
else
|
19
19
|
def self.pack_64_big_endian(long_long)
|
20
20
|
result = [long_long].pack(Q)
|
21
|
-
result.
|
21
|
+
result.bytes.to_a.reverse.map(&:chr).join
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.unpack_64_big_endian(data)
|
25
|
-
data = data.
|
25
|
+
data = data.bytes.to_a.reverse.map(&:chr).join
|
26
26
|
data.unpack(Q)
|
27
27
|
end
|
28
28
|
end
|
data/lib/amq/protocol/version.rb
CHANGED
data/spec/amq/hacks_spec.rb
CHANGED
@@ -19,21 +19,42 @@ module AMQ
|
|
19
19
|
}
|
20
20
|
}
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
it "packs integers into big-endian string" do
|
23
|
+
examples.each do |key, value|
|
24
|
+
described_class.pack_64_big_endian(key).should == value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should unpack string representation into integer" do
|
29
|
+
examples.each do |key, value|
|
30
|
+
described_class.unpack_64_big_endian(value)[0].should == key
|
27
31
|
end
|
28
32
|
end
|
33
|
+
|
34
|
+
if RUBY_VERSION < '1.9'
|
35
|
+
describe "with utf encoding" do
|
36
|
+
before do
|
37
|
+
$KCODE = 'u'
|
38
|
+
end
|
39
|
+
|
40
|
+
after do
|
41
|
+
$KCODE = 'NONE'
|
42
|
+
end
|
43
|
+
|
44
|
+
it "packs integers into big-endian string" do
|
45
|
+
examples.each do |key, value|
|
46
|
+
described_class.pack_64_big_endian(key).should == value
|
47
|
+
end
|
48
|
+
end
|
29
49
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
50
|
+
it "should unpack string representation into integer" do
|
51
|
+
examples.each do |key, value|
|
52
|
+
described_class.unpack_64_big_endian(value)[0].should == key
|
53
|
+
end
|
34
54
|
end
|
35
55
|
end
|
36
56
|
end
|
57
|
+
|
37
58
|
end
|
38
59
|
end
|
39
60
|
end
|
@@ -137,13 +137,13 @@ module AMQ
|
|
137
137
|
|
138
138
|
|
139
139
|
|
140
|
-
|
140
|
+
it "is capable of decoding empty array table values" do
|
141
141
|
input = { "arrayvalue" => Array.new }
|
142
142
|
Table.decode(Table.encode(input)).should == input
|
143
143
|
end
|
144
144
|
|
145
145
|
|
146
|
-
|
146
|
+
it "is capable of decoding single string value array table values" do
|
147
147
|
input = { "arrayvalue" => ["amq-protocol"] }
|
148
148
|
Table.decode(Table.encode(input)).should == input
|
149
149
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amq-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 1
|
10
|
+
version: 0.8.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jakub Stastny
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-
|
21
|
+
date: 2011-09-05 00:00:00 +04:00
|
22
22
|
default_executable:
|
23
23
|
dependencies: []
|
24
24
|
|