msgpack 0.5.8-x86-mingw32 → 0.5.9-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +26 -0
- data/ChangeLog +6 -0
- data/README.rdoc +1 -0
- data/Rakefile +19 -10
- data/doclib/msgpack/packer.rb +2 -3
- data/doclib/msgpack/unpacker.rb +17 -13
- data/ext/msgpack/extconf.rb +2 -0
- data/ext/msgpack/packer.h +6 -1
- data/ext/msgpack/unpacker.c +7 -0
- data/lib/msgpack/version.rb +1 -1
- data/msgpack.org.md +46 -0
- data/spec/{buffer_io_spec.rb → cruby/buffer_io_spec.rb} +0 -0
- data/spec/cruby/buffer_packer.rb +29 -0
- data/spec/{buffer_spec.rb → cruby/buffer_spec.rb} +0 -0
- data/spec/cruby/buffer_unpacker.rb +19 -0
- data/spec/packer_spec.rb +0 -7
- data/spec/unpacker_spec.rb +30 -12
- metadata +24 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 168f0afcffc21c9fc7fa34d194fbb9108ba5373c
|
4
|
-
data.tar.gz: 49c15b833c1229cf9b4ace272f2260baa5adb4bb
|
5
2
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36c46946487df8c6398f7edc8d51f152a277b55c18c23da7c6fff3648f5858e406031dc331eb1f5594c406b67b047842fdfede1646c44c84530eb06d28876c9b
|
4
|
+
data.tar.gz: f7e48f52f63226041c955a3fd098ee62be7525b90a33d69e90e87e0098e866ed226454270ccfb4410c37a582d1167e0b851e8f3df7485d44dac79df53440a06c
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: 3cb555badb7b839b1d56f93bc7b6401a0c731cbb
|
7
|
+
data.tar.gz: 9911e95d2763588c04f42229cd000a3a5fc5e469
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 1.8.7
|
5
|
+
- 1.9.3
|
6
|
+
- 2.0.0
|
7
|
+
- 2.1
|
8
|
+
- ruby-head
|
9
|
+
- rbx-2
|
10
|
+
#- jruby-18mode
|
11
|
+
#- jruby-19mode
|
12
|
+
|
13
|
+
os:
|
14
|
+
- linux
|
15
|
+
- osx
|
16
|
+
|
17
|
+
branches:
|
18
|
+
only:
|
19
|
+
- master
|
20
|
+
|
21
|
+
gemfile:
|
22
|
+
- Gemfile
|
23
|
+
|
24
|
+
matrix:
|
25
|
+
allow_failures:
|
26
|
+
- rvm: ruby-head
|
data/ChangeLog
CHANGED
data/README.rdoc
CHANGED
@@ -26,6 +26,7 @@ or build msgpack-ruby and install:
|
|
26
26
|
|
27
27
|
= Use cases
|
28
28
|
|
29
|
+
* Create REST API returing MessagePack using Rails + [RABL](https://github.com/nesquena/rabl)
|
29
30
|
* Store objects efficiently serialized by msgpack on memcached or Redis
|
30
31
|
* In fact Redis supports msgpack in EVAL-scripts[http://redis.io/commands/eval]
|
31
32
|
* Upload data in efficient format from mobile devices such as smartphones
|
data/Rakefile
CHANGED
@@ -8,13 +8,6 @@ require 'rspec/core'
|
|
8
8
|
require 'rspec/core/rake_task'
|
9
9
|
require 'yard'
|
10
10
|
|
11
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
12
|
-
t.rspec_opts = ["-c", "-f progress"]
|
13
|
-
t.rspec_opts << "-Ilib"
|
14
|
-
t.pattern = 'spec/**/*_spec.rb'
|
15
|
-
t.verbose = true
|
16
|
-
end
|
17
|
-
|
18
11
|
task :spec => :compile
|
19
12
|
|
20
13
|
desc 'Run RSpec code examples and measure coverage'
|
@@ -37,21 +30,37 @@ if RUBY_PLATFORM =~ /java/
|
|
37
30
|
|
38
31
|
Rake::JavaExtensionTask.new('msgpack', spec) do |ext|
|
39
32
|
ext.ext_dir = 'ext/java'
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
ext.lib_dir = File.join(*['lib', 'msgpack', ENV['FAT_DIR']].compact)
|
34
|
+
ext.classpath = Dir['lib/msgpack/java/*.jar'].map { |x| File.expand_path x }.join ':'
|
35
|
+
end
|
36
|
+
|
37
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
38
|
+
t.rspec_opts = ["-c", "-f progress"]
|
39
|
+
t.rspec_opts << "-Ilib"
|
40
|
+
t.pattern = 'spec/{,jruby/}*_spec.rb'
|
41
|
+
t.verbose = true
|
43
42
|
end
|
44
43
|
|
45
44
|
else
|
46
45
|
require 'rake/extensiontask'
|
47
46
|
|
48
47
|
Rake::ExtensionTask.new('msgpack', spec) do |ext|
|
48
|
+
ext.ext_dir = 'ext/msgpack'
|
49
49
|
ext.cross_compile = true
|
50
50
|
ext.lib_dir = File.join(*['lib', 'msgpack', ENV['FAT_DIR']].compact)
|
51
51
|
#ext.cross_platform = 'i386-mswin32'
|
52
52
|
end
|
53
|
+
|
54
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
55
|
+
t.rspec_opts = ["-c", "-f progress"]
|
56
|
+
t.rspec_opts << "-Ilib"
|
57
|
+
t.pattern = 'spec/{,cruby/}*_spec.rb'
|
58
|
+
t.verbose = true
|
59
|
+
end
|
53
60
|
end
|
54
61
|
|
62
|
+
CLEAN.include('lib/msgpack/msgpack.*')
|
63
|
+
|
55
64
|
task :default => [:spec, :build, :doc]
|
56
65
|
|
57
66
|
|
data/doclib/msgpack/packer.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module MessagePack
|
2
2
|
|
3
3
|
#
|
4
|
-
# MessagePack::Packer is
|
5
|
-
# which is a MessagePack::Buffer.
|
4
|
+
# MessagePack::Packer is a class to serialize objects.
|
6
5
|
#
|
7
6
|
class Packer
|
8
7
|
#
|
@@ -31,7 +30,7 @@ module MessagePack
|
|
31
30
|
attr_reader :buffer
|
32
31
|
|
33
32
|
#
|
34
|
-
# Serializes an object into internal buffer.
|
33
|
+
# Serializes an object into internal buffer, and flushes to io if necessary.
|
35
34
|
#
|
36
35
|
# If it could not serialize the object, it raises
|
37
36
|
# NoMethodError: undefined method `to_msgpack' for #<the_object>.
|
data/doclib/msgpack/unpacker.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module MessagePack
|
2
2
|
|
3
3
|
#
|
4
|
-
# MessagePack::Unpacker is
|
5
|
-
# which is a MessagePack::Buffer.
|
4
|
+
# MessagePack::Unpacker is a class to deserialize objects.
|
6
5
|
#
|
7
6
|
class Unpacker
|
8
7
|
#
|
@@ -34,11 +33,16 @@ module MessagePack
|
|
34
33
|
attr_reader :buffer
|
35
34
|
|
36
35
|
#
|
37
|
-
# Deserializes an object from internal buffer and returns it.
|
36
|
+
# Deserializes an object from the io or internal buffer and returns it.
|
38
37
|
#
|
39
|
-
#
|
38
|
+
# This method reads data from io into the internal buffer and deserializes an object
|
39
|
+
# from the buffer. It repeats reading data from the io until enough data is available
|
40
|
+
# to deserialize at least one object. After deserializing one object, unused data is
|
41
|
+
# left in the internal buffer.
|
42
|
+
#
|
43
|
+
# If there're not enough data to deserialize one object, this method raises EOFError.
|
40
44
|
# If data format is invalid, this method raises MessagePack::MalformedFormatError.
|
41
|
-
# If the
|
45
|
+
# If the object nests too deeply, this method raises MessagePack::StackError.
|
42
46
|
#
|
43
47
|
# @return [Object] deserialized object
|
44
48
|
#
|
@@ -50,7 +54,7 @@ module MessagePack
|
|
50
54
|
#
|
51
55
|
# Deserializes an object and ignores it. This method is faster than _read_.
|
52
56
|
#
|
53
|
-
# This method could raise same errors with _read_.
|
57
|
+
# This method could raise the same errors with _read_.
|
54
58
|
#
|
55
59
|
# @return nil
|
56
60
|
#
|
@@ -62,7 +66,7 @@ module MessagePack
|
|
62
66
|
# Otherwise, if a byte exists but the byte doesn't represent nil value,
|
63
67
|
# returns _false_.
|
64
68
|
#
|
65
|
-
# If there're not enough
|
69
|
+
# If there're not enough data, this method raises EOFError.
|
66
70
|
#
|
67
71
|
# @return [Boolean]
|
68
72
|
#
|
@@ -74,7 +78,7 @@ module MessagePack
|
|
74
78
|
# It converts a serialized array into a stream of elements.
|
75
79
|
#
|
76
80
|
# If the serialized object is not an array, it raises MessagePack::TypeError.
|
77
|
-
# If there're not enough
|
81
|
+
# If there're not enough data, this method raises EOFError.
|
78
82
|
#
|
79
83
|
# @return [Integer] size of the array
|
80
84
|
#
|
@@ -86,7 +90,7 @@ module MessagePack
|
|
86
90
|
# It converts a serialized map into a stream of key-value pairs.
|
87
91
|
#
|
88
92
|
# If the serialized object is not a map, it raises MessagePack::TypeError.
|
89
|
-
# If there're not enough
|
93
|
+
# If there're not enough data, this method raises EOFError.
|
90
94
|
#
|
91
95
|
# @return [Integer] size of the map
|
92
96
|
#
|
@@ -95,7 +99,7 @@ module MessagePack
|
|
95
99
|
|
96
100
|
#
|
97
101
|
# Appends data into the internal buffer.
|
98
|
-
# This method
|
102
|
+
# This method is equivalent to unpacker.buffer.append(data).
|
99
103
|
#
|
100
104
|
# @param data [String]
|
101
105
|
# @return [Unpacker] self
|
@@ -106,7 +110,7 @@ module MessagePack
|
|
106
110
|
#
|
107
111
|
# Repeats to deserialize objects.
|
108
112
|
#
|
109
|
-
# It repeats until the internal buffer does not include any complete objects.
|
113
|
+
# It repeats until the io or internal buffer does not include any complete objects.
|
110
114
|
#
|
111
115
|
# If the an IO is set, it repeats to read data from the IO when the buffer
|
112
116
|
# becomes empty until the IO raises EOFError.
|
@@ -121,7 +125,7 @@ module MessagePack
|
|
121
125
|
|
122
126
|
#
|
123
127
|
# Appends data into the internal buffer and repeats to deserialize objects.
|
124
|
-
# This method is
|
128
|
+
# This method is equivalent to unpacker.feed(data) && unpacker.each { ... }.
|
125
129
|
#
|
126
130
|
# @param data [String]
|
127
131
|
# @yieldparam object [Object] deserialized object
|
@@ -131,7 +135,7 @@ module MessagePack
|
|
131
135
|
end
|
132
136
|
|
133
137
|
#
|
134
|
-
#
|
138
|
+
# Clears the internal buffer and resets deserialization state of the unpacker.
|
135
139
|
#
|
136
140
|
# @return nil
|
137
141
|
#
|
data/ext/msgpack/extconf.rb
CHANGED
@@ -4,6 +4,8 @@ have_header("ruby/st.h")
|
|
4
4
|
have_header("st.h")
|
5
5
|
have_func("rb_str_replace", ["ruby.h"])
|
6
6
|
have_func("rb_intern_str", ["ruby.h"])
|
7
|
+
have_func("rb_sym2str", ["ruby.h"])
|
8
|
+
have_func("rb_str_intern", ["ruby.h"])
|
7
9
|
|
8
10
|
$CFLAGS << %[ -I.. -Wall -O3 -g -std=c99]
|
9
11
|
#$CFLAGS << %[ -DDISABLE_RMEM]
|
data/ext/msgpack/packer.h
CHANGED
@@ -334,15 +334,20 @@ static inline void msgpack_packer_write_string_value(msgpack_packer_t* pk, VALUE
|
|
334
334
|
|
335
335
|
static inline void msgpack_packer_write_symbol_value(msgpack_packer_t* pk, VALUE v)
|
336
336
|
{
|
337
|
+
#ifdef HAVE_RB_SYM2STR
|
338
|
+
/* rb_sym2str is added since MRI 2.2.0 */
|
339
|
+
msgpack_packer_write_string_value(pk, rb_sym2str(v));
|
340
|
+
#else
|
337
341
|
const char* name = rb_id2name(SYM2ID(v));
|
338
|
-
/* actual return type of strlen is size_t */
|
339
342
|
unsigned long len = strlen(name);
|
343
|
+
/* actual return type of strlen is size_t */
|
340
344
|
if(len > 0xffffffffUL) {
|
341
345
|
// TODO rb_eArgError?
|
342
346
|
rb_raise(rb_eArgError, "size of symbol is too long to pack: %lu bytes should be <= %lu", len, 0xffffffffUL);
|
343
347
|
}
|
344
348
|
msgpack_packer_write_raw_header(pk, (unsigned int)len);
|
345
349
|
msgpack_buffer_append(PACKER_BUFFER_(pk), name, len);
|
350
|
+
#endif
|
346
351
|
}
|
347
352
|
|
348
353
|
static inline void msgpack_packer_write_fixnum_value(msgpack_packer_t* pk, VALUE v)
|
data/ext/msgpack/unpacker.c
CHANGED
@@ -549,6 +549,7 @@ int msgpack_unpacker_read_array_header(msgpack_unpacker_t* uk, uint32_t* result_
|
|
549
549
|
return PRIMITIVE_UNEXPECTED_TYPE;
|
550
550
|
}
|
551
551
|
|
552
|
+
reset_head_byte(uk);
|
552
553
|
return 0;
|
553
554
|
}
|
554
555
|
|
@@ -576,6 +577,7 @@ int msgpack_unpacker_read_map_header(msgpack_unpacker_t* uk, uint32_t* result_si
|
|
576
577
|
return PRIMITIVE_UNEXPECTED_TYPE;
|
577
578
|
}
|
578
579
|
|
580
|
+
reset_head_byte(uk);
|
579
581
|
return 0;
|
580
582
|
}
|
581
583
|
|
@@ -609,11 +611,16 @@ int msgpack_unpacker_read(msgpack_unpacker_t* uk, size_t target_stack_depth)
|
|
609
611
|
case STACK_TYPE_MAP_VALUE:
|
610
612
|
if(uk->symbolize_keys && rb_type(top->key) == T_STRING) {
|
611
613
|
/* here uses rb_intern_str instead of rb_intern so that Ruby VM can GC unused symbols */
|
614
|
+
#ifdef HAVE_RB_STR_INTERN
|
615
|
+
/* rb_str_intern is added since MRI 2.2.0 */
|
616
|
+
rb_hash_aset(top->object, rb_str_intern(top->key), uk->last_object);
|
617
|
+
#else
|
612
618
|
#ifndef HAVE_RB_INTERN_STR
|
613
619
|
/* MRI 1.8 doesn't have rb_intern_str or rb_intern2 */
|
614
620
|
rb_hash_aset(top->object, ID2SYM(rb_intern(RSTRING_PTR(top->key))), uk->last_object);
|
615
621
|
#else
|
616
622
|
rb_hash_aset(top->object, ID2SYM(rb_intern_str(top->key)), uk->last_object);
|
623
|
+
#endif
|
617
624
|
#endif
|
618
625
|
} else {
|
619
626
|
rb_hash_aset(top->object, top->key, uk->last_object);
|
data/lib/msgpack/version.rb
CHANGED
data/msgpack.org.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# MessagePack for Ruby
|
2
|
+
|
3
|
+
```
|
4
|
+
require 'msgpack'
|
5
|
+
msg = [1,2,3].to_msgpack #=> "\x93\x01\x02\x03"
|
6
|
+
MessagePack.unpack(msg) #=> [1,2,3]
|
7
|
+
```
|
8
|
+
|
9
|
+
## Install
|
10
|
+
|
11
|
+
```
|
12
|
+
gem install msgpack
|
13
|
+
```
|
14
|
+
|
15
|
+
## Use cases
|
16
|
+
|
17
|
+
* Create REST API returing MessagePack using Rails + [RABL](https://github.com/nesquena/rabl)
|
18
|
+
* Store objects efficiently in memcached or Redis
|
19
|
+
* Upload data in efficient format from mobile devices. See also MessagePack for [Objective-C](https://github.com/msgpack/msgpack-objectivec) and [Java](https://github.com/msgpack/msgpack-java)
|
20
|
+
|
21
|
+
## Links
|
22
|
+
|
23
|
+
* [Github](https://github.com/msgpack/msgpack-ruby)
|
24
|
+
* [API document](http://ruby.msgpack.org/)
|
25
|
+
|
26
|
+
## Streaming API
|
27
|
+
|
28
|
+
```
|
29
|
+
# serialize a 2-element array [e1, e2]
|
30
|
+
pk = MessagePack::Packer.new(io)
|
31
|
+
pk.write_array_header(2).write(e1).write(e2).flush
|
32
|
+
```
|
33
|
+
|
34
|
+
```
|
35
|
+
# deserialize objects from an IO
|
36
|
+
u = MessagePack::Unpacker.new(io)
|
37
|
+
u.each { |obj| ... }
|
38
|
+
```
|
39
|
+
|
40
|
+
```
|
41
|
+
# event-driven deserialization
|
42
|
+
def on_read(data)
|
43
|
+
@u ||= MessagePack::Unpacker.new
|
44
|
+
@u.feed_each(data) { |obj| ... }
|
45
|
+
end
|
46
|
+
```
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
require 'stringio'
|
5
|
+
if defined?(Encoding)
|
6
|
+
Encoding.default_external = 'ASCII-8BIT'
|
7
|
+
end
|
8
|
+
|
9
|
+
describe Packer do
|
10
|
+
let :packer do
|
11
|
+
Packer.new
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'initialize' do
|
15
|
+
Packer.new
|
16
|
+
Packer.new(nil)
|
17
|
+
Packer.new(StringIO.new)
|
18
|
+
Packer.new({})
|
19
|
+
Packer.new(StringIO.new, {})
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'buffer' do
|
23
|
+
o1 = packer.buffer.object_id
|
24
|
+
packer.buffer << 'frsyuki'
|
25
|
+
packer.buffer.to_s.should == 'frsyuki'
|
26
|
+
packer.buffer.object_id.should == o1
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Unpacker do
|
5
|
+
let :unpacker do
|
6
|
+
Unpacker.new
|
7
|
+
end
|
8
|
+
|
9
|
+
let :packer do
|
10
|
+
Packer.new
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'buffer' do
|
14
|
+
o1 = unpacker.buffer.object_id
|
15
|
+
unpacker.buffer << 'frsyuki'
|
16
|
+
unpacker.buffer.to_s.should == 'frsyuki'
|
17
|
+
unpacker.buffer.object_id.should == o1
|
18
|
+
end
|
19
|
+
end
|
data/spec/packer_spec.rb
CHANGED
@@ -65,13 +65,6 @@ describe Packer do
|
|
65
65
|
io.string.should == "\xc0"
|
66
66
|
end
|
67
67
|
|
68
|
-
it 'buffer' do
|
69
|
-
o1 = packer.buffer.object_id
|
70
|
-
packer.buffer << 'frsyuki'
|
71
|
-
packer.buffer.to_s.should == 'frsyuki'
|
72
|
-
packer.buffer.object_id.should == o1
|
73
|
-
end
|
74
|
-
|
75
68
|
it 'to_msgpack returns String' do
|
76
69
|
nil.to_msgpack.class.should == String
|
77
70
|
true.to_msgpack.class.should == String
|
data/spec/unpacker_spec.rb
CHANGED
@@ -24,11 +24,33 @@ describe Unpacker do
|
|
24
24
|
}.should raise_error(MessagePack::TypeError)
|
25
25
|
end
|
26
26
|
|
27
|
+
it 'read_map_header converts an map to key-value sequence' do
|
28
|
+
packer.write_array_header(2)
|
29
|
+
packer.write("e")
|
30
|
+
packer.write(1)
|
31
|
+
unpacker = Unpacker.new
|
32
|
+
unpacker.feed(packer.to_s)
|
33
|
+
unpacker.read_array_header.should == 2
|
34
|
+
unpacker.read.should == "e"
|
35
|
+
unpacker.read.should == 1
|
36
|
+
end
|
37
|
+
|
27
38
|
it 'read_map_header succeeds' do
|
28
39
|
unpacker.feed("\x81")
|
29
40
|
unpacker.read_map_header.should == 1
|
30
41
|
end
|
31
42
|
|
43
|
+
it 'read_map_header converts an map to key-value sequence' do
|
44
|
+
packer.write_map_header(1)
|
45
|
+
packer.write("k")
|
46
|
+
packer.write("v")
|
47
|
+
unpacker = Unpacker.new
|
48
|
+
unpacker.feed(packer.to_s)
|
49
|
+
unpacker.read_map_header.should == 1
|
50
|
+
unpacker.read.should == "k"
|
51
|
+
unpacker.read.should == "v"
|
52
|
+
end
|
53
|
+
|
32
54
|
it 'read_map_header fails' do
|
33
55
|
unpacker.feed("\x91")
|
34
56
|
lambda {
|
@@ -53,7 +75,8 @@ describe Unpacker do
|
|
53
75
|
packer.write(4)
|
54
76
|
packer.write(5)
|
55
77
|
|
56
|
-
unpacker = Unpacker.new
|
78
|
+
unpacker = Unpacker.new
|
79
|
+
unpacker.feed(packer.to_s)
|
57
80
|
|
58
81
|
unpacker.read.should == 1
|
59
82
|
unpacker.skip
|
@@ -131,13 +154,6 @@ describe Unpacker do
|
|
131
154
|
unpacker.each.map {|x| x }.should == [1]
|
132
155
|
end
|
133
156
|
|
134
|
-
it 'buffer' do
|
135
|
-
o1 = unpacker.buffer.object_id
|
136
|
-
unpacker.buffer << 'frsyuki'
|
137
|
-
unpacker.buffer.to_s.should == 'frsyuki'
|
138
|
-
unpacker.buffer.object_id.should == o1
|
139
|
-
end
|
140
|
-
|
141
157
|
it 'frozen short strings' do
|
142
158
|
raw = sample_object.to_msgpack.to_s.force_encoding('UTF-8')
|
143
159
|
lambda {
|
@@ -156,7 +172,8 @@ describe Unpacker do
|
|
156
172
|
512.times { packer.write_array_header(1) }
|
157
173
|
packer.write(nil)
|
158
174
|
|
159
|
-
unpacker = Unpacker.new
|
175
|
+
unpacker = Unpacker.new
|
176
|
+
unpacker.feed(packer.to_s)
|
160
177
|
lambda {
|
161
178
|
unpacker.read
|
162
179
|
}.should raise_error(MessagePack::StackError)
|
@@ -166,7 +183,8 @@ describe Unpacker do
|
|
166
183
|
512.times { packer.write_array_header(1) }
|
167
184
|
packer.write(nil)
|
168
185
|
|
169
|
-
unpacker = Unpacker.new
|
186
|
+
unpacker = Unpacker.new
|
187
|
+
unpacker.feed(packer.to_s)
|
170
188
|
lambda {
|
171
189
|
unpacker.skip
|
172
190
|
}.should raise_error(MessagePack::StackError)
|
@@ -232,8 +250,8 @@ describe Unpacker do
|
|
232
250
|
|
233
251
|
it 'MessagePack.unpack symbolize_keys' do
|
234
252
|
symbolized_hash = {:a => 'b', :c => 'd'}
|
235
|
-
MessagePack.load(MessagePack.pack(symbolized_hash), symbolize_keys
|
236
|
-
MessagePack.unpack(MessagePack.pack(symbolized_hash), symbolize_keys
|
253
|
+
MessagePack.load(MessagePack.pack(symbolized_hash), :symbolize_keys => true).should == symbolized_hash
|
254
|
+
MessagePack.unpack(MessagePack.pack(symbolized_hash), :symbolize_keys => true).should == symbolized_hash
|
237
255
|
end
|
238
256
|
|
239
257
|
it 'Unpacker#unpack symbolize_keys' do
|
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: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
@@ -9,68 +9,68 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2014-10-06 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
type: :development
|
16
15
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
17
|
- - ~>
|
19
18
|
- !ruby/object:Gem::Version
|
20
19
|
version: "1.0"
|
21
|
-
name: bundler
|
22
20
|
prerelease: false
|
21
|
+
type: :development
|
23
22
|
requirement: *id001
|
23
|
+
name: bundler
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
|
-
type: :development
|
26
25
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
27
26
|
requirements:
|
28
27
|
- - ~>
|
29
28
|
- !ruby/object:Gem::Version
|
30
29
|
version: 0.9.2
|
31
|
-
name: rake
|
32
30
|
prerelease: false
|
31
|
+
type: :development
|
33
32
|
requirement: *id002
|
33
|
+
name: rake
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
type: :development
|
36
35
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
37
36
|
requirements:
|
38
37
|
- - ~>
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: 0.8.3
|
41
|
-
name: rake-compiler
|
42
40
|
prerelease: false
|
41
|
+
type: :development
|
43
42
|
requirement: *id003
|
43
|
+
name: rake-compiler
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
|
-
type: :development
|
46
45
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
47
46
|
requirements:
|
48
47
|
- - ~>
|
49
48
|
- !ruby/object:Gem::Version
|
50
49
|
version: "2.11"
|
51
|
-
name: rspec
|
52
50
|
prerelease: false
|
51
|
+
type: :development
|
53
52
|
requirement: *id004
|
53
|
+
name: rspec
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
|
-
type: :development
|
56
55
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
57
56
|
requirements:
|
58
57
|
- - ~>
|
59
58
|
- !ruby/object:Gem::Version
|
60
59
|
version: "1.7"
|
61
|
-
name: json
|
62
60
|
prerelease: false
|
61
|
+
type: :development
|
63
62
|
requirement: *id005
|
63
|
+
name: json
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
|
-
type: :development
|
66
65
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
67
66
|
requirements:
|
68
67
|
- - ~>
|
69
68
|
- !ruby/object:Gem::Version
|
70
69
|
version: 0.8.2
|
71
|
-
name: yard
|
72
70
|
prerelease: false
|
71
|
+
type: :development
|
73
72
|
requirement: *id006
|
73
|
+
name: yard
|
74
74
|
description: MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.
|
75
75
|
email: frsyuki@gmail.com
|
76
76
|
executables: []
|
@@ -81,6 +81,7 @@ extra_rdoc_files: []
|
|
81
81
|
|
82
82
|
files:
|
83
83
|
- .gitignore
|
84
|
+
- .travis.yml
|
84
85
|
- ChangeLog
|
85
86
|
- Gemfile
|
86
87
|
- README.rdoc
|
@@ -114,22 +115,25 @@ files:
|
|
114
115
|
- ext/msgpack/unpacker_class.c
|
115
116
|
- ext/msgpack/unpacker_class.h
|
116
117
|
- lib/msgpack.rb
|
118
|
+
- lib/msgpack/1.8/msgpack.so
|
119
|
+
- lib/msgpack/1.9/msgpack.so
|
120
|
+
- lib/msgpack/2.0/msgpack.so
|
117
121
|
- lib/msgpack/version.rb
|
118
122
|
- msgpack.gemspec
|
119
|
-
-
|
120
|
-
- spec/buffer_spec.rb
|
123
|
+
- msgpack.org.md
|
121
124
|
- spec/cases.json
|
122
125
|
- spec/cases.msg
|
123
126
|
- spec/cases_compact.msg
|
124
127
|
- spec/cases_spec.rb
|
128
|
+
- spec/cruby/buffer_io_spec.rb
|
129
|
+
- spec/cruby/buffer_packer.rb
|
130
|
+
- spec/cruby/buffer_spec.rb
|
131
|
+
- spec/cruby/buffer_unpacker.rb
|
125
132
|
- spec/format_spec.rb
|
126
133
|
- spec/packer_spec.rb
|
127
134
|
- spec/random_compat.rb
|
128
135
|
- spec/spec_helper.rb
|
129
136
|
- spec/unpacker_spec.rb
|
130
|
-
- lib/msgpack/1.8/msgpack.so
|
131
|
-
- lib/msgpack/1.9/msgpack.so
|
132
|
-
- lib/msgpack/2.0/msgpack.so
|
133
137
|
homepage: http://msgpack.org/
|
134
138
|
licenses:
|
135
139
|
- Apache 2.0
|
@@ -152,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
156
|
requirements: []
|
153
157
|
|
154
158
|
rubyforge_project: msgpack
|
155
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.4.2
|
156
160
|
signing_key:
|
157
161
|
specification_version: 4
|
158
162
|
summary: MessagePack, a binary-based efficient data interchange format.
|