cbor 0.5.6.2
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 +7 -0
- data/.gitignore +22 -0
- data/.travis.yml +5 -0
- data/ChangeLog +87 -0
- data/README.rdoc +180 -0
- data/Rakefile +94 -0
- data/cbor.gemspec +26 -0
- data/doclib/cbor.rb +80 -0
- data/doclib/cbor/buffer.rb +193 -0
- data/doclib/cbor/core_ext.rb +133 -0
- data/doclib/cbor/error.rb +14 -0
- data/doclib/cbor/packer.rb +133 -0
- data/doclib/cbor/simple.rb +15 -0
- data/doclib/cbor/tagged.rb +16 -0
- data/doclib/cbor/unpacker.rb +138 -0
- data/ext/cbor/buffer.c +693 -0
- data/ext/cbor/buffer.h +469 -0
- data/ext/cbor/buffer_class.c +516 -0
- data/ext/cbor/buffer_class.h +41 -0
- data/ext/cbor/cbor.h +69 -0
- data/ext/cbor/compat.h +136 -0
- data/ext/cbor/core_ext.c +181 -0
- data/ext/cbor/core_ext.h +35 -0
- data/ext/cbor/extconf.rb +25 -0
- data/ext/cbor/packer.c +169 -0
- data/ext/cbor/packer.h +337 -0
- data/ext/cbor/packer_class.c +304 -0
- data/ext/cbor/packer_class.h +39 -0
- data/ext/cbor/rbinit.c +51 -0
- data/ext/cbor/renamer.h +56 -0
- data/ext/cbor/rmem.c +103 -0
- data/ext/cbor/rmem.h +118 -0
- data/ext/cbor/sysdep.h +135 -0
- data/ext/cbor/sysdep_endian.h +59 -0
- data/ext/cbor/sysdep_types.h +55 -0
- data/ext/cbor/unpacker.c +735 -0
- data/ext/cbor/unpacker.h +133 -0
- data/ext/cbor/unpacker_class.c +417 -0
- data/ext/cbor/unpacker_class.h +39 -0
- data/lib/cbor.rb +9 -0
- data/lib/cbor/version.rb +3 -0
- data/spec/buffer_io_spec.rb +260 -0
- data/spec/buffer_spec.rb +576 -0
- data/spec/cases.cbor +0 -0
- data/spec/cases.cbor_stream +0 -0
- data/spec/cases.json +1 -0
- data/spec/cases.msg +0 -0
- data/spec/cases_compact.msg +0 -0
- data/spec/cases_spec.rb +39 -0
- data/spec/format_spec.rb +445 -0
- data/spec/packer_spec.rb +127 -0
- data/spec/random_compat.rb +24 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/unpacker_spec.rb +238 -0
- metadata +196 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 95c5af13f98f6a6442e2a2b9c27ed4bdef1c5813
|
4
|
+
data.tar.gz: 220ff8d73a25a32486e70a3ae863516193771661
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e9ff567a84e861e9dea28e28465b14f5ce0bea61ebd5a964c57abb53dea6e7841d26e2396a98a8e97c0250336465b221f8b0f44709254b97d776859e904cb471
|
7
|
+
data.tar.gz: 43bbd8691a9120b91385b1f0089fb3ee92d282b8ec2e63c617be1063e588849e2f84c57ad9425352c2263bf7d7cbe4fee4461b38957078784b2f0995b874cbd7
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.o
|
2
|
+
*.so
|
3
|
+
*.gem
|
4
|
+
*.class
|
5
|
+
.bundle
|
6
|
+
Gemfile*
|
7
|
+
pkg
|
8
|
+
test/debug.log
|
9
|
+
*~
|
10
|
+
/rdoc
|
11
|
+
tmp
|
12
|
+
.classpath
|
13
|
+
.project
|
14
|
+
.settings
|
15
|
+
/nbproject/private/
|
16
|
+
ext/java/build
|
17
|
+
ext/java/msgpack.jar
|
18
|
+
spec/bench*
|
19
|
+
lib/cbor/cbor.bundle
|
20
|
+
TAGS
|
21
|
+
.yardoc
|
22
|
+
doc
|
data/.travis.yml
ADDED
data/ChangeLog
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
2013-08-17 Carsten Bormann <cabo@tzi.org>
|
2
|
+
|
3
|
+
* First version of CBOR variant of this code.
|
4
|
+
|
5
|
+
2013-09-23 version 0.5.6:
|
6
|
+
|
7
|
+
* Fixed "can't modify frozen String" exception in Unpacker with ruby 2.1.0-dev
|
8
|
+
* Getting work with Ruby v2.0 on Windows (Thank you @thegreendroid)
|
9
|
+
* Fixed EOFError handling in Unpacker
|
10
|
+
|
11
|
+
|
12
|
+
2013-05-12 version 0.5.5:
|
13
|
+
|
14
|
+
* Fixed SEGV problem in to_msgpack
|
15
|
+
* Fixed a possible race condition in MessagePack.load when it loads data from IO
|
16
|
+
* mingw32 package includes binary for ruby-2.0.0
|
17
|
+
|
18
|
+
|
19
|
+
2013-03-15 version 0.5.4:
|
20
|
+
|
21
|
+
* Added missing MessagePack::Unpacker#reset method
|
22
|
+
|
23
|
+
|
24
|
+
2013-02-14 version 0.5.3:
|
25
|
+
|
26
|
+
* Fixed segfault problem on Buffer#clear (reuse rmem internal fragment optimization)
|
27
|
+
* Fixed segfault problem on Buffer (rmem free code)
|
28
|
+
|
29
|
+
|
30
|
+
2013-02-07 version 0.5.2:
|
31
|
+
|
32
|
+
* Fixed invalid pack/unpack on 32bit architecture such as Win32
|
33
|
+
* Disable rmem on Rubinius because rmem is not thread safe
|
34
|
+
|
35
|
+
|
36
|
+
2012-12-23 version 0.5.1:
|
37
|
+
|
38
|
+
* Fixed compile error with Rubinius 2.0.0-dev
|
39
|
+
* Optimized msgpack_packer_write_hash for Rubinius
|
40
|
+
|
41
|
+
|
42
|
+
2012-12-20 version 0.5.0:
|
43
|
+
|
44
|
+
* Rewrote all code and improved performance significantly
|
45
|
+
* Added MessagePack::Buffer class
|
46
|
+
* Added MessagePack::Packer class
|
47
|
+
* Added Packer#buffer and Unpacker#buffer accessors which return MessagePack::Buffer
|
48
|
+
* Added Packer#write_{array,map}_header and Unpacker#read_{array,map}_header methods
|
49
|
+
* Added Packer#write_nil and Unpacker#skip_nil methods
|
50
|
+
* Added Packer#write -> #pack alias and Unpacker#read method
|
51
|
+
* Added exception classes - UnpackError, MalformedFormatError, StackError and TypeError
|
52
|
+
* Added MessagePack.dup -> .pack and MessagePack.load -> .unpack aliases
|
53
|
+
* Added Packer#empty?, #size and #clear methods
|
54
|
+
* Added Packer#write_to(io) method to flush serialized data to IO efficiently
|
55
|
+
* Added Unpacker#skip method to skip an object efficiently
|
56
|
+
* Removed obsoleted Unpacker#fill, #execute, #execute_limit, #finished? and #data methods
|
57
|
+
* Removed obsoleted Unapcker#stream and #stream= methods. Use unpacker.buffer.io instead
|
58
|
+
|
59
|
+
|
60
|
+
2012-05-05 version 0.4.7:
|
61
|
+
|
62
|
+
* Fixed serialization of double values on ARM OABI architectures
|
63
|
+
* Fixed byteorder problem on big-endian platforms
|
64
|
+
* Don't use MRI internals in the Ruby extension for Rubinius
|
65
|
+
* Detect whether st.h is present and don't use RUBY_VM as the condition for
|
66
|
+
Rubinius
|
67
|
+
|
68
|
+
2011-08-08 version 0.4.6:
|
69
|
+
|
70
|
+
* Fixed compile error problem on Mac OS X Lion
|
71
|
+
|
72
|
+
2011-05-09 version 0.4.5:
|
73
|
+
|
74
|
+
* Improves compatibility with JRuby
|
75
|
+
|
76
|
+
2010-11-28 version 0.4.4:
|
77
|
+
|
78
|
+
* Adds Unpacker#feed_each method
|
79
|
+
* Improves compatibility with Rubinius
|
80
|
+
* Improves compatibility with ruby-1.8.5
|
81
|
+
* Encodings of String instances to UTF-8 on Ruby 1.9
|
82
|
+
|
83
|
+
2010-06-29 version 0.4.3:
|
84
|
+
|
85
|
+
* Adds MessagePack::VERSION constant
|
86
|
+
* Fixes SEGV problem caused by GC bug at MessagePack_Unpacker_mark
|
87
|
+
|
data/README.rdoc
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
= CBOR for Ruby
|
2
|
+
|
3
|
+
This is an initial Ruby implementation of the CBOR encoding, based on
|
4
|
+
the (polished) high-performance msgpack-ruby code.
|
5
|
+
|
6
|
+
Documentation will follow, but generally, if you replace MessagePack
|
7
|
+
and msgpack with CBOR and cbor in the below, you will be on the right
|
8
|
+
track.
|
9
|
+
|
10
|
+
CBOR is an object representation format defined by the IETF[http://ietf.org].
|
11
|
+
The specification[http://tools.ietf.org/html/draft-bormann-cbor]
|
12
|
+
has recently been approved as an IETF Standards-Track specification
|
13
|
+
and will be an RFC in a couple of months, after the RFC editor has done their work.
|
14
|
+
|
15
|
+
This is all based on wonderful work by frsyuki, and I have no idea how
|
16
|
+
to acknowledge him appropriately. This gem is not intended to fork or
|
17
|
+
supersede MessagePack[http://msgpack.org], which has a vibrant
|
18
|
+
ecosystem. It is just making use of the high-quality code that is
|
19
|
+
available in this community. If MessagePack works for you, go for it.
|
20
|
+
If you need CBOR, you need this.
|
21
|
+
|
22
|
+
Todos:
|
23
|
+
|
24
|
+
* This code has not yet been fully optimized, so it is still a few
|
25
|
+
percent slower than msgpack-ruby.
|
26
|
+
|
27
|
+
* Properly document things, in particular the classes CBOR::Simple and
|
28
|
+
CBOR::Tagged. If you check out the source, you can +rake doc+ to
|
29
|
+
get some documentation in the directory +doc+ (see +index.html+ there).
|
30
|
+
|
31
|
+
* So far, this has been tested on MRI (1.9.3 and 2.0.0). To do:
|
32
|
+
* Check this code out with Rubinius.
|
33
|
+
* Publish the pure-ruby version and make it work the same way on JRuby.
|
34
|
+
|
35
|
+
* Find and implement good ways to offer CBOR's indefinite length
|
36
|
+
("streaming") capability at the Ruby API level.
|
37
|
+
|
38
|
+
* Rename some of the internals from msgpack to cbor. Right now, much
|
39
|
+
of the code still uses the name msgpack in its identifiers, to
|
40
|
+
facilitate merging upstream fixes. (The msgpack and cbor gems
|
41
|
+
coexist nicely in one MRI instance due to the magic in +renamer.h+.)
|
42
|
+
|
43
|
+
Same Apache 2.0 License applies to the changes as to the original.
|
44
|
+
For the changes:
|
45
|
+
|
46
|
+
Author:: Carsten Bormann <cabo@tzi.org>
|
47
|
+
Copyright:: Copyright (c) 2013 Carsten Bormann
|
48
|
+
License:: Apache License, Version 2.0
|
49
|
+
|
50
|
+
{<img src="https://travis-ci.org/cabo/cbor-ruby.png?branch=master" />}[https://travis-ci.org/cabo/cbor-ruby]
|
51
|
+
|
52
|
+
For the original, see below.
|
53
|
+
|
54
|
+
= MessagePack
|
55
|
+
|
56
|
+
MessagePack[http://msgpack.org] is an efficient binary serialization format.
|
57
|
+
It lets you exchange data among multiple languages like JSON but it's faster and smaller.
|
58
|
+
For example, small integers (like flags or error code) are encoded into a single byte,
|
59
|
+
and typical short strings only require an extra byte in addition to the strings themselves.
|
60
|
+
|
61
|
+
If you ever wished to use JSON for convenience (storing an image with metadata) but could
|
62
|
+
not for technical reasons (binary data, size, speed...), MessagePack is a perfect replacement.
|
63
|
+
|
64
|
+
require 'msgpack'
|
65
|
+
msg = [1,2,3].to_msgpack #=> "\x93\x01\x02\x03"
|
66
|
+
MessagePack.unpack(msg) #=> [1,2,3]
|
67
|
+
|
68
|
+
Use RubyGems to install:
|
69
|
+
|
70
|
+
gem install msgpack
|
71
|
+
|
72
|
+
or build msgpack-ruby and install:
|
73
|
+
|
74
|
+
bundle
|
75
|
+
rake
|
76
|
+
gem install --local pkg/msgpack
|
77
|
+
|
78
|
+
|
79
|
+
= Use cases
|
80
|
+
|
81
|
+
* Store objects efficiently serialized by msgpack on memcached or Redis
|
82
|
+
* In fact Redis supports msgpack in EVAL-scripts[http://redis.io/commands/eval]
|
83
|
+
* Upload data in efficient format from mobile devices such as smartphones
|
84
|
+
* 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
|
85
|
+
* Design a portable protocol to communicate with embedded devices
|
86
|
+
* 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)
|
87
|
+
* Exchange objects between software components written in different languages
|
88
|
+
* You'll need a flexible but efficient format so that components exchange objects while keeping compatibility
|
89
|
+
|
90
|
+
|
91
|
+
= Portability
|
92
|
+
|
93
|
+
MessagePack for Ruby should run on x86, ARM, PowerPC, SPARC and other CPU architectures.
|
94
|
+
|
95
|
+
And it works with MRI (CRuby) and Rubinius.
|
96
|
+
Patches to improve portability is highly welcomed.
|
97
|
+
|
98
|
+
|
99
|
+
= Serializing objects
|
100
|
+
|
101
|
+
Use *MessagePack.pack* or *to_msgpack*:
|
102
|
+
|
103
|
+
require 'msgpack'
|
104
|
+
msg = MessagePack.pack(obj) # or
|
105
|
+
msg = obj.to_msgpack
|
106
|
+
|
107
|
+
== Streaming serialization
|
108
|
+
|
109
|
+
Packer provides advanced API to serialize objects in streaming style:
|
110
|
+
|
111
|
+
# serialize a 2-element array [e1, e2]
|
112
|
+
pk = MessagePack::Packer.new(io)
|
113
|
+
pk.write_array_header(2).write(e1).write(e2).flush
|
114
|
+
|
115
|
+
See {API reference}[http://ruby.msgpack.org/MessagePack/Packer.html] for details.
|
116
|
+
|
117
|
+
= Deserializing objects
|
118
|
+
|
119
|
+
Use *MessagePack.unpack*:
|
120
|
+
|
121
|
+
require 'msgpack'
|
122
|
+
obj = MessagePack.unpack(msg)
|
123
|
+
|
124
|
+
== Streaming deserialization
|
125
|
+
|
126
|
+
Unpacker provides advanced API to deserialize objects in streaming style:
|
127
|
+
|
128
|
+
# deserialize objects from an IO
|
129
|
+
u = MessagePack::Unpacker.new(io)
|
130
|
+
u.each do |obj|
|
131
|
+
# ...
|
132
|
+
end
|
133
|
+
|
134
|
+
or event-driven style which works well with EventMachine:
|
135
|
+
|
136
|
+
# event-driven deserialization
|
137
|
+
def on_read(data)
|
138
|
+
@u ||= MessagePack::Unpacker.new
|
139
|
+
@u.feed_each(data) {|obj|
|
140
|
+
# ...
|
141
|
+
}
|
142
|
+
end
|
143
|
+
|
144
|
+
See {API reference}[http://ruby.msgpack.org/MessagePack/Unpacker.html] for details.
|
145
|
+
|
146
|
+
|
147
|
+
= Buffer API
|
148
|
+
|
149
|
+
MessagePack for Ruby provides a buffer API so that you can read or write data by hand, not via Packer or Unpacker API.
|
150
|
+
|
151
|
+
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),
|
152
|
+
and has zero-copy capability which significantly affects performance to handle large binary data.
|
153
|
+
|
154
|
+
= How to build and run tests
|
155
|
+
|
156
|
+
Before building msgpack, you need to install bundler and dependencies.
|
157
|
+
|
158
|
+
gem install bundler
|
159
|
+
bundle install
|
160
|
+
|
161
|
+
Then, you can run the tasks as follows:
|
162
|
+
|
163
|
+
* Build
|
164
|
+
|
165
|
+
bundle exec rake build
|
166
|
+
|
167
|
+
* Run tests
|
168
|
+
|
169
|
+
bundle exec rake spec
|
170
|
+
|
171
|
+
* Generating docs
|
172
|
+
|
173
|
+
bundle exec rake doc
|
174
|
+
|
175
|
+
= Copyright
|
176
|
+
|
177
|
+
Author:: Sadayuki Furuhashi <frsyuki@gmail.com>
|
178
|
+
Copyright:: Copyright (c) 2008-2013 Sadayuki Furuhashi
|
179
|
+
License:: Apache License, Version 2.0
|
180
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
|
2
|
+
require 'bundler'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
require 'rspec/core'
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
require 'yard'
|
10
|
+
|
11
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
12
|
+
t.rspec_opts = ["-c", "-f documentation"]
|
13
|
+
t.rspec_opts << "-Ilib"
|
14
|
+
t.pattern = 'spec/**/*_spec.rb'
|
15
|
+
t.verbose = true
|
16
|
+
end
|
17
|
+
|
18
|
+
task :spec => :compile
|
19
|
+
|
20
|
+
desc 'Run RSpec code examples and measure coverage'
|
21
|
+
task :coverage do |t|
|
22
|
+
ENV['SIMPLE_COV'] = '1'
|
23
|
+
Rake::Task["spec"].invoke
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'Generate YARD document'
|
27
|
+
YARD::Rake::YardocTask.new(:doc) do |t|
|
28
|
+
t.files = ['lib/cbor/version.rb','doclib/**/*.rb']
|
29
|
+
t.options = []
|
30
|
+
t.options << '--debug' << '--verbose' if $trace
|
31
|
+
end
|
32
|
+
|
33
|
+
spec = eval File.read("cbor.gemspec")
|
34
|
+
|
35
|
+
if RUBY_PLATFORM =~ /java/
|
36
|
+
require 'rake/javaextensiontask'
|
37
|
+
|
38
|
+
Rake::JavaExtensionTask.new('cbor', spec) do |ext|
|
39
|
+
ext.ext_dir = 'ext/java'
|
40
|
+
#jruby_home = RbConfig::CONFIG['prefix']
|
41
|
+
#jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
|
42
|
+
#ext.classpath = jars.map { |x| File.expand_path x }.join ':'
|
43
|
+
end
|
44
|
+
|
45
|
+
else
|
46
|
+
require 'rake/extensiontask'
|
47
|
+
|
48
|
+
Rake::ExtensionTask.new('cbor', spec) do |ext|
|
49
|
+
ext.cross_compile = true
|
50
|
+
ext.lib_dir = File.join(*['lib', 'cbor', ENV['FAT_DIR']].compact)
|
51
|
+
#ext.cross_platform = 'i386-mswin32'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
task :default => :build
|
56
|
+
|
57
|
+
|
58
|
+
###
|
59
|
+
## Cross compile memo
|
60
|
+
##
|
61
|
+
## Ubuntu Ubuntu 10.04.1 LTS
|
62
|
+
##
|
63
|
+
#
|
64
|
+
### install mingw32 cross compiler with w64 support
|
65
|
+
# sudo apt-get install gcc-mingw32
|
66
|
+
# sudo apt-get install mingw-w64
|
67
|
+
#
|
68
|
+
### install rbenv
|
69
|
+
# git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
|
70
|
+
# echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
|
71
|
+
# echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
|
72
|
+
# exec $SHELL -l
|
73
|
+
#
|
74
|
+
### install cross-compiled ruby 2.0.0
|
75
|
+
# rbenv install 2.0.0-p0
|
76
|
+
# gem install rake-compiler
|
77
|
+
# rake-compiler cross-ruby VERSION=2.0.0-p0
|
78
|
+
#
|
79
|
+
### install cross-compiled ruby 1.9.3
|
80
|
+
# rbenv install 1.9.3-p327
|
81
|
+
# gem install rake-compiler
|
82
|
+
# rake-compiler cross-ruby VERSION=1.9.3-p327
|
83
|
+
#
|
84
|
+
### install cross-compiled ruby 1.8.7
|
85
|
+
# rbenv install 1.8.7-p371
|
86
|
+
# gem install rake-compiler
|
87
|
+
# rake-compiler cross-ruby VERSION=1.8.7-p371
|
88
|
+
#
|
89
|
+
### build gem
|
90
|
+
# rbenv shell 1.8.7-p371
|
91
|
+
# gem install bundler && bundle
|
92
|
+
# rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0
|
93
|
+
#
|
94
|
+
|
data/cbor.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require 'cbor/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "cbor"
|
6
|
+
s.version = CBOR::VERSION
|
7
|
+
s.summary = "CBOR, Concise Binary Object Representation."
|
8
|
+
s.description = %q{CBOR is a library for the CBOR binary object representation format, based on Sadayuki Furuhashi's MessagePack library.}
|
9
|
+
s.author = "Carsten Bormann, standing on the tall shoulders of Sadayuki Furuhashi"
|
10
|
+
s.email = "cabo@tzi.org"
|
11
|
+
s.license = "Apache 2.0"
|
12
|
+
# s.homepage = "http://msgpack.org/"
|
13
|
+
# s.rubyforge_project = "msgpack"
|
14
|
+
s.has_rdoc = false
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec}/*`.split("\n")
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.extensions = ["ext/cbor/extconf.rb"]
|
19
|
+
|
20
|
+
s.add_development_dependency 'bundler', ['~> 1.0']
|
21
|
+
s.add_development_dependency 'rake', ['~> 0.9.2']
|
22
|
+
s.add_development_dependency 'rake-compiler', ['~> 0.8.3']
|
23
|
+
s.add_development_dependency 'rspec', ['~> 2.11']
|
24
|
+
s.add_development_dependency 'json', ['~> 1.7']
|
25
|
+
s.add_development_dependency 'yard', ['~> 0.8.2']
|
26
|
+
end
|
data/doclib/cbor.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
module CBOR
|
2
|
+
#
|
3
|
+
# Serializes an object into an IO or String.
|
4
|
+
#
|
5
|
+
# @overload encode(obj)
|
6
|
+
# @return [String] serialized data
|
7
|
+
#
|
8
|
+
# @overload encode(obj, io)
|
9
|
+
# @return [IO]
|
10
|
+
#
|
11
|
+
def self.encode(arg)
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# Serializes an object into an IO or String. Alias of encode.
|
16
|
+
#
|
17
|
+
# @overload dump(obj)
|
18
|
+
# @return [String] serialized data
|
19
|
+
#
|
20
|
+
# @overload dump(obj, io)
|
21
|
+
# @return [IO]
|
22
|
+
#
|
23
|
+
def self.dump(arg)
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Serializes an object into an IO or String. Alias of encode.
|
28
|
+
#
|
29
|
+
# @overload dump(obj)
|
30
|
+
# @return [String] serialized data
|
31
|
+
#
|
32
|
+
# @overload dump(obj, io)
|
33
|
+
# @return [IO]
|
34
|
+
#
|
35
|
+
def self.pack(arg)
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Deserializes an object from an IO or String.
|
40
|
+
#
|
41
|
+
# @overload decode(string)
|
42
|
+
# @param string [String] data to deserialize
|
43
|
+
#
|
44
|
+
# @overload decode(io)
|
45
|
+
# @param io [IO]
|
46
|
+
#
|
47
|
+
# @return [Object] deserialized object
|
48
|
+
#
|
49
|
+
def self.decode(arg)
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Deserializes an object from an IO or String. Alias of decode.
|
54
|
+
#
|
55
|
+
# @overload load(string)
|
56
|
+
# @param string [String] data to deserialize
|
57
|
+
#
|
58
|
+
# @overload load(io)
|
59
|
+
# @param io [IO]
|
60
|
+
#
|
61
|
+
# @return [Object] deserialized object
|
62
|
+
#
|
63
|
+
def self.load(arg)
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Deserializes an object from an IO or String. Alias of decode.
|
68
|
+
#
|
69
|
+
# @overload unpack(string)
|
70
|
+
# @param string [String] data to deserialize
|
71
|
+
#
|
72
|
+
# @overload unpack(io)
|
73
|
+
# @param io [IO]
|
74
|
+
#
|
75
|
+
# @return [Object] deserialized object
|
76
|
+
#
|
77
|
+
def self.unpack(arg)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|