Module: MessagePack

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

Defined Under Namespace

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

Constant Summary collapse

VERSION =
"1.6.1"
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

.dump(obj, options = {}) ⇒ String .dump(obj, io, options = {}) ⇒ nil

Serializes an object into an IO or String.

See Packer#initialize for supported options.

Overloads:

  • .dump(obj, options = {}) ⇒ String

    Returns serialized data.

    Parameters:

    • obj (Object)

      object to be serialized

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

    Returns:

    • (String)

      serialized data

  • .dump(obj, io, options = {}) ⇒ nil

    Parameters:

    • obj (Object)

      object to be serialized

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

    Returns:

    • (nil)


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

def self.dump(obj)
end

.load(string, options = {}) ⇒ Object .load(io, options = {}) ⇒ Object

Deserializes an object from an IO or String.

See Unpacker#initialize for supported options.

Overloads:

  • .load(string, options = {}) ⇒ Object

    Parameters:

    • string (String)

      data to deserialize

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

    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

.pack(obj, options = {}) ⇒ String .pack(obj, io, options = {}) ⇒ nil

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

See Packer#initialize for supported options.

Overloads:

  • .pack(obj, options = {}) ⇒ String

    Returns serialized data.

    Parameters:

    • obj (Object)

      object to be serialized

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

    Returns:

    • (String)

      serialized data

  • .pack(obj, io, options = {}) ⇒ nil

    Parameters:

    • obj (Object)

      object to be serialized

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

    Returns:

    • (nil)


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

def self.pack(obj)
end

.unpack(string, options = {}) ⇒ Object .unpack(io, options = {}) ⇒ Object

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

See Unpacker#initialize for supported options.

Overloads:

  • .unpack(string, options = {}) ⇒ Object

    Parameters:

    • string (String)

      data to deserialize

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

    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