Sha256: a3af9ab0918e6320a60813d5e06f8076353b201984efff060cd09464a59e4d24

Contents?: true

Size: 1015 Bytes

Versions: 115

Compression:

Stored size: 1015 Bytes

Contents

# MessagePack for Ruby

```
require 'msgpack'
msg = [1,2,3].to_msgpack  #=> "\x93\x01\x02\x03"
MessagePack.unpack(msg)   #=> [1,2,3]
```

## Install

```
gem install msgpack
```

## Use cases

* Create REST API returing MessagePack using Rails + [RABL](https://github.com/nesquena/rabl)
* Store objects efficiently in memcached or Redis
* Upload data in efficient format from mobile devices. See also MessagePack for [Objective-C](https://github.com/msgpack/msgpack-objectivec) and [Java](https://github.com/msgpack/msgpack-java)

## Links

* [Github](https://github.com/msgpack/msgpack-ruby)
* [API document](http://ruby.msgpack.org/)

## Streaming API

```
# serialize a 2-element array [e1, e2]
pk = MessagePack::Packer.new(io)
pk.write_array_header(2).write(e1).write(e2).flush
```

```
# deserialize objects from an IO
u = MessagePack::Unpacker.new(io)
u.each { |obj| ... }
```

```
# event-driven deserialization
def on_read(data)
  @u ||= MessagePack::Unpacker.new
  @u.feed_each(data) { |obj| ... }
end
```

Version data entries

115 entries across 115 versions & 3 rubygems

Version Path
msgpack-1.6.0 msgpack.org.md
msgpack-1.5.6 msgpack.org.md
msgpack-1.5.5 msgpack.org.md
msgpack-1.5.4 msgpack.org.md
msgpack-1.5.3 msgpack.org.md
msgpack-1.5.2 msgpack.org.md
msgpack-1.5.1 msgpack.org.md
msgpack-1.5.0 msgpack.org.md
msgpack-1.4.5 msgpack.org.md
msgpack-1.4.4 msgpack.org.md
msgpack-1.4.3 msgpack.org.md
msgpack-1.4.2 msgpack.org.md
msgpack-1.4.0.pre1 msgpack.org.md
msgpack-1.3.3-x64-mingw32 msgpack.org.md
msgpack-1.3.3-x86-mingw32 msgpack.org.md
msgpack-1.3.3 msgpack.org.md
msgpack-1.3.2-x64-mingw32 msgpack.org.md
msgpack-1.3.2-x86-mingw32 msgpack.org.md
msgpack-1.3.2 msgpack.org.md
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/msgpack-1.3.1/msgpack.org.md