Module: MessagePack

Defined in:
lib/msgpack/version.rb,
doclib/msgpack.rb,
doclib/msgpack/error.rb,
doclib/msgpack/packer.rb,
doclib/msgpack/buffer.rb,
doclib/msgpack/factory.rb,
doclib/msgpack/unpacker.rb,
doclib/msgpack/extension_value.rb

Defined Under Namespace

Classes: Buffer, ExtensionValue, Factory, MalformedFormatError, Packer, StackError, UnexpectedTypeError, UnknownExtTypeError, UnpackError, Unpacker

Constant Summary

VERSION =
"0.7.0"
DefaultFactory =

An instance of Factory class. DefaultFactory is also used by global pack/unpack methods such as MessagePack.dump/load, Hash#to_msgpack, and other to_msgpack methods.

Calling DefaultFactory.register_type lets you add an extension type globally.

Factory.new

Class Method Summary (collapse)

Class Method Details

+ (String) dump(obj, options = {}) + (IO) dump(obj, io, options = {})

Serializes an object into an IO or String.

See Packer#initialize for supported options.

Overloads:

  • + (String) dump(obj, options = {})

    Returns serialized data

    Parameters:

    • obj (Object)

      object to be serialized

    • options (Hash) (defaults to: {})

    Returns:

    • (String)

      serialized data

  • + (IO) dump(obj, io, options = {})

    Parameters:

    • obj (Object)

      object to be serialized

    • io (IO)
    • options (Hash) (defaults to: {})

    Returns:

    • (IO)


19
20
# File 'doclib/msgpack.rb', line 19

def self.dump(obj)
end

+ (Object) load(string, options = {}) + (Object) load(io, options = {})

Deserializes an object from an IO or String.

See Unpacker#initialize for supported options.

Overloads:

  • + (Object) load(string, options = {})

    Parameters:

    • string (String)

      data to deserialize

    • options (Hash) (defaults to: {})
  • + (Object) load(io, options = {})

    Parameters:

    • io (IO)
    • options (Hash) (defaults to: {})

Returns:

  • (Object)

    deserialized object



56
57
# File 'doclib/msgpack.rb', line 56

def self.load(src, options={})
end

+ (String) pack(obj, options = {}) + (IO) pack(obj, io, options = {})

Serializes an object into an IO or String. Alias of dump.

See Packer#initialize for supported options.

Overloads:

  • + (String) pack(obj, options = {})

    Returns serialized data

    Parameters:

    • obj (Object)

      object to be serialized

    • options (Hash) (defaults to: {})

    Returns:

    • (String)

      serialized data

  • + (IO) pack(obj, io, options = {})

    Parameters:

    • obj (Object)

      object to be serialized

    • io (IO)
    • options (Hash) (defaults to: {})

    Returns:

    • (IO)


38
39
# File 'doclib/msgpack.rb', line 38

def self.pack(obj)
end

+ (Object) unpack(string, options = {}) + (Object) unpack(io, options = {})

Deserializes an object from an IO or String. Alias of load.

See Unpacker#initialize for supported options.

Overloads:

  • + (Object) unpack(string, options = {})

    Parameters:

    • string (String)

      data to deserialize

    • options (Hash) (defaults to: {})
  • + (Object) unpack(io, options = {})

    Parameters:

    • io (IO)
    • options (Hash) (defaults to: {})

Returns:

  • (Object)

    deserialized object



74
75
# File 'doclib/msgpack.rb', line 74

def self.unpack(src, options={})
end