msgpack 1.2.7-java → 1.2.8-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/msgpack.rb +3 -2
- data/lib/msgpack/version.rb +1 -1
- data/spec/msgpack_spec.rb +43 -0
- metadata +2 -3
- data/lib/msgpack/msgpack.jar +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eddf5eec527a64e763acf319a2cabfcee3452f0103ca4ace3731c09ad324ce04
|
4
|
+
data.tar.gz: eee57526448a41f3d090fba54d244fcda94cdec1ffe8671b38ca8e76a711a5ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb05e946b2a8c1cd820c164af0ebbcae36ef26b602eb1e5db323f31285185346d368b73047f76ce6cce5fb7ddd4ebe4b228be353d56fa13bf9df73d591ae92cf
|
7
|
+
data.tar.gz: 18dbd2a375f263f0cbaac4af3f303903681450ec12013fe68566b6177d73b94c6b5ddcf0d51b7f85e612fbb5e5cba7c57e5af705a511ec11e45d43fa22392392
|
data/lib/msgpack.rb
CHANGED
@@ -20,15 +20,16 @@ require "msgpack/core_ext"
|
|
20
20
|
|
21
21
|
module MessagePack
|
22
22
|
DefaultFactory = MessagePack::Factory.new
|
23
|
+
DEFAULT_EMPTY_PARAMS = {}.freeze
|
23
24
|
|
24
25
|
def load(src, param = nil)
|
25
26
|
unpacker = nil
|
26
27
|
|
27
28
|
if src.is_a? String
|
28
|
-
unpacker = DefaultFactory.unpacker param
|
29
|
+
unpacker = DefaultFactory.unpacker param || DEFAULT_EMPTY_PARAMS
|
29
30
|
unpacker.feed src
|
30
31
|
else
|
31
|
-
unpacker = DefaultFactory.unpacker src, param
|
32
|
+
unpacker = DefaultFactory.unpacker src, param || DEFAULT_EMPTY_PARAMS
|
32
33
|
end
|
33
34
|
|
34
35
|
unpacker.full_unpack
|
data/lib/msgpack/version.rb
CHANGED
data/spec/msgpack_spec.rb
CHANGED
@@ -168,4 +168,47 @@ describe MessagePack do
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
171
|
+
|
172
|
+
context 'when the source is na IO-like object' do
|
173
|
+
require 'tempfile'
|
174
|
+
require 'stringio'
|
175
|
+
|
176
|
+
it 'work with IO destination object as 2nd argument of MessagePack.pack' do
|
177
|
+
Tempfile.create("pack-test") do |io|
|
178
|
+
return_value = MessagePack.pack(utf8enc('hello world'), io)
|
179
|
+
return_value.should be_nil
|
180
|
+
|
181
|
+
io.rewind
|
182
|
+
io.read.force_encoding(Encoding::ASCII_8BIT).should eq("\xABhello world".force_encoding(Encoding::ASCII_8BIT))
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'work with IO-like StringIO destination object as 2nd argument of MessagePack.pack' do
|
187
|
+
io = StringIO.new
|
188
|
+
return_value = MessagePack.pack(utf8enc('hello world'), io)
|
189
|
+
return_value.should be_nil
|
190
|
+
|
191
|
+
io.rewind
|
192
|
+
io.read.force_encoding(Encoding::ASCII_8BIT).should eq("\xABhello world".force_encoding(Encoding::ASCII_8BIT))
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'work with IO source object as source of MessagePack.unpack' do
|
196
|
+
Tempfile.create("unpack-test") do |io|
|
197
|
+
MessagePack.pack(utf8enc('hello world'), io)
|
198
|
+
io.rewind
|
199
|
+
|
200
|
+
return_value = MessagePack.unpack(io)
|
201
|
+
return_value.should eq(utf8enc('hello world'))
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'work with IO-like StringIO object of MessagePack.unpack' do
|
206
|
+
io = StringIO.new
|
207
|
+
MessagePack.pack(utf8enc('hello world'), io)
|
208
|
+
io.rewind
|
209
|
+
|
210
|
+
return_value = MessagePack.unpack(io)
|
211
|
+
return_value.should eq(utf8enc('hello world'))
|
212
|
+
end
|
213
|
+
end
|
171
214
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msgpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-03-
|
13
|
+
date: 2019-03-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,7 +110,6 @@ files:
|
|
110
110
|
- lib/msgpack.rb
|
111
111
|
- lib/msgpack/core_ext.rb
|
112
112
|
- lib/msgpack/factory.rb
|
113
|
-
- lib/msgpack/msgpack.jar
|
114
113
|
- lib/msgpack/packer.rb
|
115
114
|
- lib/msgpack/symbol.rb
|
116
115
|
- lib/msgpack/unpacker.rb
|
data/lib/msgpack/msgpack.jar
DELETED
Binary file
|