Module: MessagePack
- Defined in:
- lib/msgpack/time.rb,
lib/msgpack.rb,
lib/msgpack/bigint.rb,
lib/msgpack/buffer.rb,
lib/msgpack/packer.rb,
lib/msgpack/factory.rb,
lib/msgpack/version.rb,
lib/msgpack/core_ext.rb,
lib/msgpack/core_ext.rb,
lib/msgpack/unpacker.rb,
lib/msgpack/timestamp.rb,
ext/msgpack/rbinit.c
Overview
MessagePack extention packer and unpacker for built-in Time class
Defined Under Namespace
Modules: Bigint, CoreExt, Time, TypeError
Classes: Buffer, Factory, MalformedFormatError, Packer, StackError, Timestamp, UnexpectedTypeError, UnknownExtTypeError, UnpackError, Unpacker
Constant Summary
collapse
- DefaultFactory =
MessagePack::Factory.new
- VERSION =
"1.7.1"
- ExtensionValue =
cMessagePack_ExtensionValue
Class Method Summary
collapse
Class Method Details
.dump ⇒ Object
44
45
46
47
48
|
# File 'lib/msgpack.rb', line 44
def pack(v, io = nil, options = nil)
packer = DefaultFactory.packer(io, options)
packer.write v
packer.full_pack
end
|
.load(src, param = nil) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/msgpack.rb', line 22
def load(src, param = nil)
unpacker = nil
if src.is_a? String
unpacker = DefaultFactory.unpacker param
unpacker.feed_reference src
else
unpacker = DefaultFactory.unpacker src, param
end
unpacker.full_unpack
end
|
.pack(v, io = nil, options = nil) ⇒ Object
39
40
41
42
43
|
# File 'lib/msgpack.rb', line 39
def pack(v, io = nil, options = nil)
packer = DefaultFactory.packer(io, options)
packer.write v
packer.full_pack
end
|
.unpack ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/msgpack.rb', line 34
def load(src, param = nil)
unpacker = nil
if src.is_a? String
unpacker = DefaultFactory.unpacker param
unpacker.feed_reference src
else
unpacker = DefaultFactory.unpacker src, param
end
unpacker.full_unpack
end
|