msgpack 0.5.11 → 0.5.12

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YmU2YTk2ZGQ2NTEzN2ZjZjVlZTU4MjExZTUyNTMzNjdjNGNkYTM4Mw==
5
- data.tar.gz: !binary |-
6
- YmQ2ZGQ4NjEyMWZlODk2NzE0NzkwY2YxZThkY2E3MDVmNGY2NzRjZA==
2
+ SHA1:
3
+ metadata.gz: f05c681ebe9804b5eb686077eea1fc3a10367a29
4
+ data.tar.gz: 69c047b4a6b5fdb7f58e39ea3ed116687724b814
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NmZjODQxMjA4MDM3NjFmM2RiMDQ4YTZlMjYyNGI5MmM3NWI5NzQyMTZmODll
10
- NjA3MGJlODFhYTg5YTNlYTA4YTM1MTQxNDRhMTg5ZjUxYTA0NjUwNGE4MjU4
11
- YTk1N2M2ZWZmMDQ2OWNjODFlZGNmZjBkY2E5OGYwOGQyN2IwMWY=
12
- data.tar.gz: !binary |-
13
- NzcwODU2ZjViYTYyMGUxOWU2Y2E4Yjc2YzVhMGQ1ZjIzYmMwY2Q4NTVkYTI3
14
- YzdiOGQ3M2IzZGI3ZmRhYjIyZjdjMDI3NjZkYTEzZjY2YmVmNWM4NDQ5NjFk
15
- NThkMGEyZTMwMmUyOThjYzdkOWY5NDE1Yzg0ZTNhMWU5NjZjYjA=
6
+ metadata.gz: aa7f7bf48dc87a4ecaf0705f9a05f4aa488626d09b38a6c82b7de94b4e17cbb528721fffdf863993aef2f9ff8151b5819f06e75afac149df1d2f5278010417bc
7
+ data.tar.gz: e737efa666a613b7aff2e523c12277be1a704dc339898124a891dcfba452a8d2090884ef2601d3ea8979113fd2c0667743d3f5c61345f1768db1132092ee8c9e
@@ -8,6 +8,7 @@ rvm:
8
8
  - ruby-head
9
9
  - rbx-2
10
10
  - jruby-19mode
11
+ - jruby-head
11
12
 
12
13
  os:
13
14
  - linux
@@ -23,3 +24,4 @@ gemfile:
23
24
  matrix:
24
25
  allow_failures:
25
26
  - rvm: ruby-head
27
+ - rvm: jruby-head
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,23 @@
1
+ require 'viiite'
2
+ require 'msgpack'
3
+
4
+ data = { 'hello' => 'world', 'nested' => ['structure', {value: 42}] }
5
+ data_sym = { hello: 'world', nested: ['structure', {value: 42}] }
6
+
7
+ data = MessagePack.pack(:hello => 'world', :nested => ['structure', {:value => 42}])
8
+
9
+ Viiite.bench do |b|
10
+ b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
11
+ b.report(:strings) do
12
+ runs.times do
13
+ MessagePack.pack(data)
14
+ end
15
+ end
16
+
17
+ b.report(:symbols) do
18
+ runs.times do
19
+ MessagePack.pack(data_sym)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ require 'viiite'
2
+ require 'msgpack'
3
+
4
+ data_plain = { 'message' => '127.0.0.1 - - [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"' }
5
+ data_structure = {
6
+ 'remote_host' => '127.0.0.1',
7
+ 'remote_user' => '-',
8
+ 'date' => '10/Oct/2000:13:55:36 -0700',
9
+ 'request' => 'GET /apache_pb.gif HTTP/1.0',
10
+ 'method' => 'GET',
11
+ 'path' => '/apache_pb.gif',
12
+ 'protocol' => 'HTTP/1.0',
13
+ 'status' => 200,
14
+ 'bytes' => 2326,
15
+ 'referer' => 'http://www.example.com/start.html',
16
+ 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
17
+ }
18
+
19
+ Viiite.bench do |b|
20
+ b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
21
+ b.report(:plain) do
22
+ runs.times do
23
+ MessagePack.pack(data_plain)
24
+ end
25
+ end
26
+
27
+ b.report(:structure) do
28
+ runs.times do
29
+ MessagePack.pack(data_structure)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,65 @@
1
+ # viiite report --regroup bench,threads bench/pack_log_long.rb
2
+
3
+ require 'viiite'
4
+ require 'msgpack'
5
+
6
+ data_plain = { 'message' => '127.0.0.1 - - [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"' }
7
+ data_structure = {
8
+ 'remote_host' => '127.0.0.1',
9
+ 'remote_user' => '-',
10
+ 'date' => '10/Oct/2000:13:55:36 -0700',
11
+ 'request' => 'GET /apache_pb.gif HTTP/1.0',
12
+ 'method' => 'GET',
13
+ 'path' => '/apache_pb.gif',
14
+ 'protocol' => 'HTTP/1.0',
15
+ 'status' => 200,
16
+ 'bytes' => 2326,
17
+ 'referer' => 'http://www.example.com/start.html',
18
+ 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
19
+ }
20
+
21
+ seconds = 3600 # 1 hour
22
+
23
+ Viiite.bench do |b|
24
+ b.range_over([1, 2, 4, 8, 16], :threads) do |threads|
25
+ b.report(:plain) do
26
+ ths = []
27
+ end_at = Time.now + seconds
28
+ threads.times do
29
+ t = Thread.new do
30
+ packs = 0
31
+ while Time.now < end_at
32
+ 10000.times do
33
+ MessagePack.pack(data_plain)
34
+ end
35
+ packs += 10000
36
+ end
37
+ packs
38
+ end
39
+ ths.push t
40
+ end
41
+ sum = ths.reduce(0){|r,t| r + t.value }
42
+ puts "MessagePack.pack, plain, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
43
+ end
44
+
45
+ b.report(:structure) do
46
+ ths = []
47
+ end_at = Time.now + seconds
48
+ threads.times do
49
+ t = Thread.new do
50
+ packs = 0
51
+ while Time.now < end_at
52
+ 10000.times do
53
+ MessagePack.pack(data_structure)
54
+ end
55
+ packs += 10000
56
+ end
57
+ packs
58
+ end
59
+ ths.push t
60
+ end
61
+ sum = ths.reduce(0){|r,t| r + t.value }
62
+ puts "MessagePack.pack, structured, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,14 @@
1
+ #!/bin/sh
2
+
3
+ # prerequisites
4
+ # $ rbenv shell 2.2.1 (or jruby-x.x.x or ...)
5
+ # $ rake install
6
+
7
+ echo "pack"
8
+ viiite report --regroup bench,runs bench/pack.rb
9
+ echo "unpack"
10
+ viiite report --regroup bench,runs bench/unpack.rb
11
+ echo "pack log"
12
+ viiite report --regroup bench,runs bench/pack_log.rb
13
+ echo "unpack log"
14
+ viiite report --regroup bench,runs bench/unpack_log.rb
@@ -0,0 +1,35 @@
1
+ #!/bin/sh
2
+
3
+ # prerequisites
4
+ # $ sudo apt-get install sysstat
5
+ # $ rbenv shell 2.2.1 (or jruby-x.x.x or ...)
6
+ # $ rake install
7
+
8
+ # 60 * 600 : 60*60 * 5[threads] * 2[bench]
9
+
10
+ ruby -v
11
+
12
+ echo "pack log long"
13
+ viiite report --regroup bench,threads bench/pack_log_long.rb &
14
+ sar -o pack_log_long.sar -r 60 600 > /dev/null 2>&1 &
15
+
16
+ declare -i i=0
17
+ while [ $i -lt 600 ]; do
18
+ ps auxww | grep ruby | grep -v grep | awk '{print $5,$6;}' >> pack_log_long.mem.txt
19
+ i=i+1
20
+ sleep 60
21
+ done
22
+
23
+ sleep 120 # cool down
24
+
25
+ echo "unpack log long"
26
+ viiite report --regroup bench,threads bench/unpack_log_long.rb &
27
+ sar -o unpack_log_long.sar -r 60 600 > /dev/null 2>&1 &
28
+
29
+ i=0
30
+ while [ $i -lt 600 ]; do
31
+ ps auxww | grep ruby | grep -v grep | awk '{print $5,$6;}' >> pack_log_long.mem.txt
32
+ i=i+1
33
+ sleep 60
34
+ done
35
+
@@ -0,0 +1,21 @@
1
+ require 'viiite'
2
+ require 'msgpack'
3
+
4
+ data = MessagePack.pack(:hello => 'world', :nested => ['structure', {:value => 42}])
5
+
6
+ Viiite.bench do |b|
7
+ b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
8
+ b.report(:strings) do
9
+ runs.times do
10
+ MessagePack.unpack(data)
11
+ end
12
+ end
13
+
14
+ b.report(:symbols) do
15
+ options = {:symbolize_keys => true}
16
+ runs.times do
17
+ MessagePack.unpack(data, options)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,34 @@
1
+ require 'viiite'
2
+ require 'msgpack'
3
+
4
+ data_plain = MessagePack.pack({ 'message' => '127.0.0.1 - - [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"' })
5
+
6
+ data_structure = MessagePack.pack({
7
+ 'remote_host' => '127.0.0.1',
8
+ 'remote_user' => '-',
9
+ 'date' => '10/Oct/2000:13:55:36 -0700',
10
+ 'request' => 'GET /apache_pb.gif HTTP/1.0',
11
+ 'method' => 'GET',
12
+ 'path' => '/apache_pb.gif',
13
+ 'protocol' => 'HTTP/1.0',
14
+ 'status' => 200,
15
+ 'bytes' => 2326,
16
+ 'referer' => 'http://www.example.com/start.html',
17
+ 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
18
+ })
19
+
20
+ Viiite.bench do |b|
21
+ b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
22
+ b.report(:plain) do
23
+ runs.times do
24
+ MessagePack.unpack(data_plain)
25
+ end
26
+ end
27
+
28
+ b.report(:structure) do
29
+ runs.times do
30
+ MessagePack.unpack(data_structure)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,67 @@
1
+ # viiite report --regroup bench,threads bench/pack_log_long.rb
2
+
3
+ require 'viiite'
4
+ require 'msgpack'
5
+
6
+ data_plain = MessagePack.pack({
7
+ 'message' => '127.0.0.1 - - [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"'
8
+ })
9
+ data_structure = MessagePack.pack({
10
+ 'remote_host' => '127.0.0.1',
11
+ 'remote_user' => '-',
12
+ 'date' => '10/Oct/2000:13:55:36 -0700',
13
+ 'request' => 'GET /apache_pb.gif HTTP/1.0',
14
+ 'method' => 'GET',
15
+ 'path' => '/apache_pb.gif',
16
+ 'protocol' => 'HTTP/1.0',
17
+ 'status' => 200,
18
+ 'bytes' => 2326,
19
+ 'referer' => 'http://www.example.com/start.html',
20
+ 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
21
+ })
22
+
23
+ seconds = 3600 # 1 hour
24
+
25
+ Viiite.bench do |b|
26
+ b.range_over([1, 2, 4, 8, 16], :threads) do |threads|
27
+ b.report(:plain) do
28
+ ths = []
29
+ end_at = Time.now + seconds
30
+ threads.times do
31
+ t = Thread.new do
32
+ packs = 0
33
+ while Time.now < end_at
34
+ 10000.times do
35
+ MessagePack.unpack(data_plain)
36
+ end
37
+ packs += 10000
38
+ end
39
+ packs
40
+ end
41
+ ths.push t
42
+ end
43
+ sum = ths.reduce(0){|r,t| r + t.value }
44
+ puts "MessagePack.unpack, plain, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
45
+ end
46
+
47
+ b.report(:structure) do
48
+ ths = []
49
+ end_at = Time.now + seconds
50
+ threads.times do
51
+ t = Thread.new do
52
+ packs = 0
53
+ while Time.now < end_at
54
+ 10000.times do
55
+ MessagePack.unpack(data_structure)
56
+ end
57
+ packs += 10000
58
+ end
59
+ packs
60
+ end
61
+ ths.push t
62
+ end
63
+ sum = ths.reduce(0){|r,t| r + t.value }
64
+ puts "MessagePack.unpack, structured, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
65
+ end
66
+ end
67
+ end
@@ -192,7 +192,7 @@ public class Encoder {
192
192
  Encoding encoding = object.getEncoding();
193
193
  boolean binary = encoding == binaryEncoding;
194
194
  if (encoding != utf8Encoding && encoding != binaryEncoding) {
195
- object = (RubyString) ((RubyString) object).encode(runtime.getCurrentContext(), RubyEncoding.newEncoding(runtime, utf8Encoding));
195
+ object = (RubyString) ((RubyString) object).encode(runtime.getCurrentContext(), runtime.getEncodingService().getEncoding(utf8Encoding));
196
196
  }
197
197
  ByteList bytes = object.getByteList();
198
198
  int length = bytes.length();
@@ -96,16 +96,10 @@ public class MessagePackLibrary implements Library {
96
96
  @JRubyMethod(module = true, required = 1, optional = 1, alias = {"load"})
97
97
  public static IRubyObject unpack(ThreadContext ctx, IRubyObject recv, IRubyObject[] args) {
98
98
  Decoder decoder = new Decoder(ctx.getRuntime(), args[0].asString().getBytes());
99
- if (args.length > 1) {
100
- if (args[args.length - 1] instanceof RubyHash) {
101
- Ruby runtime = ctx.getRuntime();
102
- IRubyObject symbolizeKeys = ((RubyHash) args[args.length - 1]).fastARef((IRubyObject) runtime.getSymbolTable().getSymbol("symbolize_keys"));
103
- if (symbolizeKeys instanceof RubyNil || symbolizeKeys instanceof RubyBoolean.False) {
104
- decoder.symbolizeKeys(false);
105
- } else {
106
- decoder.symbolizeKeys(true);
107
- }
108
- }
99
+ if (args.length > 1 && !args[args.length - 1].isNil()) {
100
+ RubyHash hash = args[args.length - 1].convertToHash();
101
+ IRubyObject symbolizeKeys = hash.fastARef(ctx.getRuntime().newSymbol("symbolize_keys"));
102
+ decoder.symbolizeKeys(symbolizeKeys != null && symbolizeKeys.isTrue());
109
103
  }
110
104
  return decoder.next();
111
105
  }
@@ -1,3 +1,3 @@
1
1
  module MessagePack
2
- VERSION = "0.5.11"
2
+ VERSION = "0.5.12"
3
3
  end
@@ -122,6 +122,12 @@ describe MessagePack do
122
122
  unpacked.should == {:hello => 'world', :nested => ['object', {:structure => true}]}
123
123
  end
124
124
 
125
+ it 'does not symbolize keys even if other options are present' do
126
+ packed = MessagePack.pack({'hello' => 'world', 'nested' => ['object', {'structure' => true}]})
127
+ unpacked = MessagePack.unpack(packed, :other_option => false)
128
+ unpacked.should == {'hello' => 'world', 'nested' => ['object', {'structure' => true}]}
129
+ end
130
+
125
131
  it 'can unpack strings with a specified encoding', :encodings do
126
132
  packed = MessagePack.pack({utf8enc('hello') => utf8enc('world')})
127
133
  unpacked = MessagePack.unpack(packed)
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.11
4
+ version: 0.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -9,90 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-04 00:00:00.000000000 Z
12
+ date: 2015-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.9.2
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 0.9.2
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rake-compiler
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 0.8.3
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.8.3
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rspec
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '2.11'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '2.11'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: json
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ~>
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
76
  version: '1.7'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ~>
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '1.7'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: yard
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ~>
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
90
  version: 0.8.2
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: 0.8.2
98
98
  description: MessagePack is a binary-based efficient object serialization library.
@@ -106,12 +106,21 @@ extensions:
106
106
  - ext/msgpack/extconf.rb
107
107
  extra_rdoc_files: []
108
108
  files:
109
- - .gitignore
110
- - .travis.yml
109
+ - ".gitignore"
110
+ - ".travis.yml"
111
111
  - ChangeLog
112
112
  - Gemfile
113
+ - LICENSE
113
114
  - README.rdoc
114
115
  - Rakefile
116
+ - bench/pack.rb
117
+ - bench/pack_log.rb
118
+ - bench/pack_log_long.rb
119
+ - bench/run.sh
120
+ - bench/run_long.sh
121
+ - bench/unpack.rb
122
+ - bench/unpack_log.rb
123
+ - bench/unpack_log_long.rb
115
124
  - doclib/msgpack.rb
116
125
  - doclib/msgpack/buffer.rb
117
126
  - doclib/msgpack/core_ext.rb
@@ -181,17 +190,17 @@ require_paths:
181
190
  - lib
182
191
  required_ruby_version: !ruby/object:Gem::Requirement
183
192
  requirements:
184
- - - ! '>='
193
+ - - ">="
185
194
  - !ruby/object:Gem::Version
186
195
  version: '0'
187
196
  required_rubygems_version: !ruby/object:Gem::Requirement
188
197
  requirements:
189
- - - ! '>='
198
+ - - ">="
190
199
  - !ruby/object:Gem::Version
191
200
  version: '0'
192
201
  requirements: []
193
202
  rubyforge_project: msgpack
194
- rubygems_version: 2.2.2
203
+ rubygems_version: 2.4.5
195
204
  signing_key:
196
205
  specification_version: 4
197
206
  summary: MessagePack, a binary-based efficient data interchange format.