module MessagePack::CoreExt

def to_msgpack(packer_or_io = nil)

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