msgpack 1.4.0.pre1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
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.4.0.pre1
4
+ version: 1.4.2
5
5
  platform: ruby
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: 2020-09-08 00:00:00.000000000 Z
13
+ date: 2021-02-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -44,30 +44,16 @@ dependencies:
44
44
  name: rake-compiler
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '1.0'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - "~>"
55
- - !ruby/object:Gem::Version
56
- version: '1.0'
57
- - !ruby/object:Gem::Dependency
58
- name: rake-compiler-dock
59
- requirement: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - "~>"
47
+ - - ">="
62
48
  - !ruby/object:Gem::Version
63
- version: '1.0'
49
+ version: '0'
64
50
  type: :development
65
51
  prerelease: false
66
52
  version_requirements: !ruby/object:Gem::Requirement
67
53
  requirements:
68
- - - "~>"
54
+ - - ">="
69
55
  - !ruby/object:Gem::Version
70
- version: '1.0'
56
+ version: '0'
71
57
  - !ruby/object:Gem::Dependency
72
58
  name: rspec
73
59
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +114,7 @@ files:
128
114
  - ChangeLog
129
115
  - Gemfile
130
116
  - LICENSE
131
- - README.rdoc
117
+ - README.md
132
118
  - Rakefile
133
119
  - appveyor.yml
134
120
  - bench/pack.rb
@@ -236,14 +222,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
236
222
  requirements:
237
223
  - - ">="
238
224
  - !ruby/object:Gem::Version
239
- version: '0'
225
+ version: '2.4'
240
226
  required_rubygems_version: !ruby/object:Gem::Requirement
241
227
  requirements:
242
- - - ">"
228
+ - - ">="
243
229
  - !ruby/object:Gem::Version
244
- version: 1.3.1
230
+ version: '0'
245
231
  requirements: []
246
- rubygems_version: 3.1.2
232
+ rubygems_version: 3.2.3
247
233
  signing_key:
248
234
  specification_version: 4
249
235
  summary: MessagePack, a binary-based efficient data interchange format.
data/README.rdoc DELETED
@@ -1,225 +0,0 @@
1
-
2
- = MessagePack
3
-
4
- MessagePack[http://msgpack.org] is an efficient binary serialization format.
5
- It lets you exchange data among multiple languages like JSON but it's faster and smaller.
6
- For example, small integers (like flags or error code) are encoded into a single byte,
7
- and typical short strings only require an extra byte in addition to the strings themselves.
8
-
9
- If you ever wished to use JSON for convenience (storing an image with metadata) but could
10
- not for technical reasons (binary data, size, speed...), MessagePack is a perfect replacement.
11
-
12
- require 'msgpack'
13
- msg = [1,2,3].to_msgpack #=> "\x93\x01\x02\x03"
14
- MessagePack.unpack(msg) #=> [1,2,3]
15
-
16
- Use RubyGems to install:
17
-
18
- gem install msgpack
19
-
20
- or build msgpack-ruby and install:
21
-
22
- bundle
23
- rake
24
- gem install --local pkg/msgpack
25
-
26
-
27
- = Use cases
28
-
29
- * Create REST API returing MessagePack using Rails + [RABL](https://github.com/nesquena/rabl)
30
- * Store objects efficiently serialized by msgpack on memcached or Redis
31
- * In fact Redis supports msgpack in EVAL-scripts[http://redis.io/commands/eval]
32
- * Upload data in efficient format from mobile devices such as smartphones
33
- * MessagePack works on iPhone/iPad and Android. See also Objective-C[https://github.com/msgpack/msgpack-objectivec] and Java[https://github.com/msgpack/msgpack-java] implementations
34
- * Design a portable protocol to communicate with embedded devices
35
- * Check also Fluentd[http://fluentd.org/] which is a log collector which uses msgpack for the log format (they say it uses JSON but actually it's msgpack, which is compatible with JSON)
36
- * Exchange objects between software components written in different languages
37
- * You'll need a flexible but efficient format so that components exchange objects while keeping compatibility
38
-
39
- = Portability
40
-
41
- MessagePack for Ruby should run on x86, ARM, PowerPC, SPARC and other CPU architectures.
42
-
43
- And it works with MRI (CRuby) and Rubinius.
44
- Patches to improve portability is highly welcomed.
45
-
46
-
47
- = Serializing objects
48
-
49
- Use *MessagePack.pack* or *to_msgpack*:
50
-
51
- require 'msgpack'
52
- msg = MessagePack.pack(obj) # or
53
- msg = obj.to_msgpack
54
-
55
- == Streaming serialization
56
-
57
- Packer provides advanced API to serialize objects in streaming style:
58
-
59
- # serialize a 2-element array [e1, e2]
60
- pk = MessagePack::Packer.new(io)
61
- pk.write_array_header(2).write(e1).write(e2).flush
62
-
63
- See {API reference}[http://ruby.msgpack.org/MessagePack/Packer.html] for details.
64
-
65
- = Deserializing objects
66
-
67
- Use *MessagePack.unpack*:
68
-
69
- require 'msgpack'
70
- obj = MessagePack.unpack(msg)
71
-
72
- == Streaming deserialization
73
-
74
- Unpacker provides advanced API to deserialize objects in streaming style:
75
-
76
- # deserialize objects from an IO
77
- u = MessagePack::Unpacker.new(io)
78
- u.each do |obj|
79
- # ...
80
- end
81
-
82
- or event-driven style which works well with EventMachine:
83
-
84
- # event-driven deserialization
85
- def on_read(data)
86
- @u ||= MessagePack::Unpacker.new
87
- @u.feed_each(data) {|obj|
88
- # ...
89
- }
90
- end
91
-
92
- See {API reference}[http://ruby.msgpack.org/MessagePack/Unpacker.html] for details.
93
-
94
- = Serializing and deserializing symbols
95
-
96
- By default, symbols are serialized as strings:
97
-
98
- packed = :symbol.to_msgpack # => "\xA6symbol"
99
- MessagePack.unpack(packed) # => "symbol"
100
-
101
- This can be customized by registering an extension type for them:
102
-
103
- MessagePack::DefaultFactory.register_type(0x00, Symbol)
104
-
105
- # symbols now survive round trips
106
- packed = :symbol.to_msgpack # => "\xc7\x06\x00symbol"
107
- MessagePack.unpack(packed) # => :symbol
108
-
109
- The extension type for symbols is configurable like any other extension type.
110
- For example, to customize how symbols are packed you can just redefine
111
- Symbol#to_msgpack_ext. Doing this gives you an option to prevent symbols from
112
- being serialized altogether by throwing an exception:
113
-
114
- class Symbol
115
- def to_msgpack_ext
116
- raise "Serialization of symbols prohibited"
117
- end
118
- end
119
-
120
- MessagePack::DefaultFactory.register_type(0x00, Symbol)
121
-
122
- [1, :symbol, 'string'].to_msgpack # => RuntimeError: Serialization of symbols prohibited
123
-
124
- = Serializing and deserializing Time instances
125
-
126
- There are the timestamp extension type in MessagePack,
127
- but it is not registered by default.
128
-
129
- To map Ruby's Time to MessagePack's timestamp for the default factory:
130
-
131
- MessagePack::DefaultFactory.register_type(
132
- MessagePack::Timestamp::TYPE, # or just -1
133
- Time,
134
- packer: MessagePack::Time::Packer,
135
- unpacker: MessagePack::Time::Unpacker
136
- )
137
-
138
- See {API reference}[http://ruby.msgpack.org/] for details.
139
-
140
- = Extension Types
141
-
142
- Packer and Unpacker support {Extension types of MessagePack}[https://github.com/msgpack/msgpack/blob/master/spec.md#types-extension-type].
143
-
144
- # register how to serialize custom class at first
145
- pk = MessagePack::Packer.new(io)
146
- pk.register_type(0x01, MyClass1, :to_msgpack_ext) # equal to pk.register_type(0x01, MyClass)
147
- pk.register_type(0x02, MyClass2){|obj| obj.how_to_serialize() } # blocks also available
148
-
149
- # almost same API for unpacker
150
- uk = MessagePack::Unpacker.new()
151
- uk.register_type(0x01, MyClass1, :from_msgpack_ext)
152
- uk.register_type(0x02){|data| MyClass2.create_from_serialized_data(data) }
153
-
154
- MessagePack::Factory is to create packer and unpacker which have same extension types.
155
-
156
- factory = MessagePack::Factory.new
157
- factory.register_type(0x01, MyClass1) # same with next line
158
- factory.register_type(0x01, MyClass1, packer: :to_msgpack_ext, unpacker: :from_msgpack_ext)
159
- pk = factory.packer(options_for_packer)
160
- uk = factory.unpacker(options_for_unpacker)
161
-
162
- For *MessagePack.pack* and *MessagePack.unpack*, default packer/unpacker refer *MessagePack::DefaultFactory*. Call *MessagePack::DefaultFactory.register_type* to enable types process globally.
163
-
164
- MessagePack::DefaultFactory.register_type(0x03, MyClass3)
165
- MessagePack.unpack(data_with_ext_typeid_03) #=> MyClass3 instance
166
-
167
- = Buffer API
168
-
169
- MessagePack for Ruby provides a buffer API so that you can read or write data by hand, not via Packer or Unpacker API.
170
-
171
- This {MessagePack::Buffer}[http://ruby.msgpack.org/MessagePack/Buffer.html] is backed with a fixed-length shared memory pool which is very fast for small data (<= 4KB),
172
- and has zero-copy capability which significantly affects performance to handle large binary data.
173
-
174
- = How to build and run tests
175
-
176
- Before building msgpack, you need to install bundler and dependencies.
177
-
178
- gem install bundler
179
- bundle install
180
-
181
- Then, you can run the tasks as follows:
182
-
183
- * Build
184
-
185
- bundle exec rake build
186
-
187
- * Run tests
188
-
189
- bundle exec rake spec
190
-
191
- * Generating docs
192
-
193
- bundle exec rake doc
194
-
195
- == How to build -java rubygems
196
-
197
- To build -java gems for JRuby, run:
198
-
199
- rake build:java
200
-
201
- If this directory has Gemfile.lock (generated with MRI), remove it beforehand.
202
-
203
- == How to build -mingw32 rubygems
204
-
205
- MessagePack mingw32/64 rubygems build process uses {rake-compiler-dock}[https://github.com/rake-compiler/rake-compiler-dock]. Run:
206
-
207
- rake build:windows
208
-
209
- Once this step successes, target gems exist in pkg/msgpack-*-{x86,x64}-mingw32.gem.
210
-
211
- == Updating documents
212
-
213
- Online documents (http://ruby.msgpack.org) is generated from gh-pages branch.
214
- Following commands update documents in gh-pages branch:
215
-
216
- bundle exec rake doc
217
- git checkout gh-pages
218
- cp doc/* ./ -a
219
-
220
- = Copyright
221
-
222
- Author:: Sadayuki Furuhashi <frsyuki@gmail.com>
223
- Copyright:: Copyright (c) 2008-2015 Sadayuki Furuhashi
224
- License:: Apache License, Version 2.0
225
-