Module: MessagePack::CoreExt

Included in:
Array, Bignum, FalseClass, Fixnum, Float, Hash, Integer, NilClass, String, Symbol, TrueClass
Defined in:
lib/msgpack/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#to_msgpack(packer_or_io = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/msgpack/core_ext.rb', line 3

def to_msgpack(packer_or_io = nil)
  if packer_or_io
    if packer_or_io.is_a?(MessagePack::Packer)
      to_msgpack_with_packer packer_or_io
    else
      MessagePack.pack(self, packer_or_io)
    end
  else
    MessagePack.pack(self)
  end
end