Module: MessagePackPure

Defined in:
lib/msgpack_pure/packer.rb,
lib/msgpack_pure/core.rb,
lib/msgpack_pure/version.rb,
lib/msgpack_pure/unpacker.rb

Overview

MessagePack format specification msgpack.sourceforge.jp/spec

Defined Under Namespace

Classes: Packer, Unpacker

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.pack(value) ⇒ Object



8
9
10
11
12
13
# File 'lib/msgpack_pure/core.rb', line 8

def self.pack(value)
  io = StringIO.new
  packer = Packer.new(io)
  packer.write(value)
  return io.string
end

.unpack(binary) ⇒ Object



15
16
17
18
19
# File 'lib/msgpack_pure/core.rb', line 15

def self.unpack(binary)
  io = StringIO.new(binary, "r")
  unpacker = Unpacker.new(io)
  return unpacker.read
end