msgpack 1.2.7-x86-mingw32 → 1.2.8-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +5 -0
- data/doclib/msgpack.rb +2 -2
- data/ext/java/org/msgpack/jruby/Buffer.java +4 -0
- data/ext/java/org/msgpack/jruby/Factory.java +1 -1
- data/ext/java/org/msgpack/jruby/Packer.java +3 -0
- data/lib/msgpack.rb +3 -2
- data/lib/msgpack/version.rb +1 -1
- data/spec/msgpack_spec.rb +43 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26b0874c056a9487fd862ace31cf7f23e28902deb3f3b75596c8f493a3b94908
|
4
|
+
data.tar.gz: db77e96afc3aaecf807e653b9657884d600b6be525ac07ca2fe3b798c1f0d327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8b8c2dfc473d5fc1b22c8a76aed5b4b18ba65bef38b6dafe0b17ff1b44281b77c59eb4f9a856a3dfbfbc378f661868ec77d1d8151fab8eaf19148139e5fcc6e
|
7
|
+
data.tar.gz: 0a664f512df0a8c093a40db21e4968c50fa0e25ee2ab4dd10c54a2995425cd22645d427bec9ded32ebe7d4c11480f14762da46298657b807cff046f0e31aa5af
|
data/ChangeLog
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
2019-03-11 version 1.2.8:
|
2
|
+
|
3
|
+
* Fix a regression that MessagePack#unpack raises error if IO is assigned as the (only) argument
|
4
|
+
* Improve compatibility that MessagePack#pack returns nil if IO is assigned as 2nd argument
|
5
|
+
|
1
6
|
2019-03-01 version 1.2.7:
|
2
7
|
|
3
8
|
* Add Packer#write_bin and Packer#write_bin_header methods
|
data/doclib/msgpack.rb
CHANGED
@@ -12,7 +12,7 @@ module MessagePack
|
|
12
12
|
# @param obj [Object] object to be serialized
|
13
13
|
# @param io [IO]
|
14
14
|
# @param options [Hash]
|
15
|
-
# @return [
|
15
|
+
# @return [nil]
|
16
16
|
#
|
17
17
|
# See Packer#initialize for supported options.
|
18
18
|
#
|
@@ -31,7 +31,7 @@ module MessagePack
|
|
31
31
|
# @param obj [Object] object to be serialized
|
32
32
|
# @param io [IO]
|
33
33
|
# @param options [Hash]
|
34
|
-
# @return [
|
34
|
+
# @return [nil]
|
35
35
|
#
|
36
36
|
# See Packer#initialize for supported options.
|
37
37
|
#
|
@@ -179,6 +179,10 @@ public class Buffer extends RubyObject {
|
|
179
179
|
return skipCommon(ctx, length, true);
|
180
180
|
}
|
181
181
|
|
182
|
+
public boolean hasIo() {
|
183
|
+
return io != null;
|
184
|
+
}
|
185
|
+
|
182
186
|
@JRubyMethod(name = "to_s", alias = {"to_str"})
|
183
187
|
public IRubyObject toS(ThreadContext ctx) {
|
184
188
|
ensureReadMode();
|
@@ -54,7 +54,7 @@ public class Factory extends RubyObject {
|
|
54
54
|
return Packer.newPacker(ctx, extensionRegistry(), hasSymbolExtType, args);
|
55
55
|
}
|
56
56
|
|
57
|
-
@JRubyMethod(name = "unpacker", optional =
|
57
|
+
@JRubyMethod(name = "unpacker", optional = 2)
|
58
58
|
public Unpacker unpacker(ThreadContext ctx, IRubyObject[] args) {
|
59
59
|
return Unpacker.newUnpacker(ctx, extensionRegistry(), args);
|
60
60
|
}
|
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: x86-mingw32
|
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
|
name: bundler
|