Sha256: fe01badd4c144c6b0d70a96350e36c80b3bb33dcd98e333a77b4696332383c05

Contents?: true

Size: 653 Bytes

Versions: 9

Compression:

Stored size: 653 Bytes

Contents

require 'msgpack'

# Serialize objects to strings by default
class Object
  def to_msgpack(packer)
    packer.pack(to_s)
  end

  def self.from_msgpack(packed)
    packed.unpack('A*').first
  end
end

# Support serialization of symbols
MessagePack::DefaultFactory.register_type(0x01, Symbol)

# For compatibility with the msgpack implementation in mruby
MessagePack::Error = MessagePack::UnpackError

# The msgpack implementation in mruby supports an ext type for classes
class Class
  alias_method :to_msgpack_ext, :to_msgpack
end
class << Class
  alias_method :from_msgpack_ext, :from_msgpack
end
MessagePack::DefaultFactory.register_type(0x02, Class)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pipe_rpc-2.5.0 lib/msgpack_config.rb
pipe_rpc-2.4.0 lib/msgpack_config.rb
pipe_rpc-2.3.0 lib/msgpack_config.rb
pipe_rpc-2.2.3 lib/msgpack_config.rb
pipe_rpc-2.2.2 lib/msgpack_config.rb
pipe_rpc-2.2.1 lib/msgpack_config.rb
pipe_rpc-2.2.0 lib/msgpack_config.rb
pipe_rpc-2.1.0 lib/msgpack_config.rb
pipe_rpc-2.0.0 lib/msgpack_config.rb