Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#to_msgpack(*args) ⇒ Object

call-seq:

hash.to_msgpack(out = '') -> String

Serializes the Hash into raw bytes. This calls to_msgpack method reflectively for internal keys and values.



253
254
255
256
257
258
259
260
# File 'ext/pack.c', line 253

static VALUE MessagePack_Hash_to_msgpack(int argc, VALUE *argv, VALUE self)
{
  ARG_BUFFER(out, argc, argv);
  // FIXME check sizeof(st_index_t) > sizeof(unsigned int) && RARRAY_LEN(self) > UINT_MAX
  msgpack_pack_map(out, (unsigned int)RHASH_SIZE(self));
  rb_hash_foreach(self, MessagePack_Hash_to_msgpack_foreach, out);
  return out;
}