Skip to content

Muriel-Salvan/ruby-serial

Repository files navigation

RubySerial

Gem Version Inline docs Build Status Code Climate Code Climate Dependency Status

Click here to lend your support to: ruby-serial and make a donation at pledgie.com !

ruby-serial is a Ruby library serializing Ruby objects, optimized in many ways:

  • Fast and small: use MessagePack (binary compact storage) and don't serialize twice the same object
  • Independent of Ruby version: dump and load data across different versions
  • Keep shared objects: if an object is shared by others, serialization still keeps the reference and does not duplicate objects in memory
  • Gives the ability to fine tune which attributes of your objects are to be serialized (defaults to all)
  • Keeps backward compatibility with previously serialized versions.
  • Has callbacks support to fine tune the serialization process.
  • Can serialize objects having reference cycles (self-contained Arrays, Hashes, objects...)

Installation

RubySerial is packaged as a simple Ruby gem:

gem install ruby-serial

Usage

Its usage is the same as Marshal library:

require 'ruby-serial'

str = RubySerial.dump [ :hello, 'World', 42 ]
# => "1\x00\x82\xA3obj\x93\x82\xA2\x00\xBB\xA2\x00\xEE\xA2\x00\xF1\xA5hello\xA5World*\xABshared_objs\x80"

RubySerial.load str
# => [:hello, "World", 42]

More info

See ruby-serial home page for more complete examples and references. Read ruby-serial documentation for a complete overview of ruby-serial features.

Contact

Contributions, questions, jokes? Send them to Muriel

About

Optimized serialization library for Ruby objects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages