Skip to content

Commit

Permalink
Merge pull request #361 from olleolleolle/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot authored Aug 8, 2024
2 parents d12b10f + d73128a commit d06b10f
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,24 @@ and typical short strings only require an extra byte in addition to the strings
If you ever wished to use JSON for convenience (storing an image with metadata) but could
not for technical reasons (binary data, size, speed...), MessagePack is a perfect replacement.

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

Add msgpack to your Gemfile to install with Bundler:

```ruby
# Gemfile
gem 'msgpack'
```

Use RubyGems to install:
Or, use RubyGems to install:

gem install msgpack

or build msgpack-ruby and install:
Or, build msgpack-ruby and install from a checked-out msgpack-ruby repository:

bundle
rake
Expand All @@ -27,11 +36,11 @@ or build msgpack-ruby and install:

* Create REST API returing MessagePack using Rails + [RABL](https://github.com/nesquena/rabl)
* Store objects efficiently serialized by msgpack on memcached or Redis
* In fact Redis supports msgpack in [EVAL-scripts](http://redis.io/commands/eval)
* In fact Redis supports msgpack in [EVAL-scripts](https://redis.io/docs/latest/commands/eval/)
* Upload data in efficient format from mobile devices such as smartphones
* 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
* Design a portable protocol to communicate with embedded devices
* 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)
* Check also [Fluentd](https://www.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)
* Exchange objects between software components written in different languages
* You'll need a flexible but efficient format so that components exchange objects while keeping compatibility

Expand Down Expand Up @@ -128,9 +137,9 @@ being serialized altogether by throwing an exception:

```ruby
class Symbol
def to_msgpack_ext
raise "Serialization of symbols prohibited"
end
def to_msgpack_ext
raise "Serialization of symbols prohibited"
end
end

MessagePack::DefaultFactory.register_type(0x00, Symbol)
Expand Down Expand Up @@ -276,8 +285,8 @@ If this directory has Gemfile.lock (generated with MRI), remove it beforehand.

## Updating documents

Online documents (http://ruby.msgpack.org) is generated from gh-pages branch.
Following commands update documents in gh-pages branch:
Online documentation (https://ruby.msgpack.org) is generated from the gh-pages branch.
To update documents in gh-pages branch:

bundle exec rake doc
git checkout gh-pages
Expand Down

0 comments on commit d06b10f

Please sign in to comment.