Class: Array

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

Instance Method Summary collapse

Instance Method Details

#to_msgpack(*args) ⇒ Object

call-seq:

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

Serializes the Array into raw bytes. This calls to_msgpack method reflectively for internal elements.



218
219
220
221
222
223
224
225
226
227
228
229
# File 'ext/pack.c', line 218

static VALUE MessagePack_Array_to_msgpack(int argc, VALUE *argv, VALUE self)
{
  ARG_BUFFER(out, argc, argv);
  // FIXME check sizeof(long) > sizeof(unsigned int) && RARRAY_LEN(self) > UINT_MAX
  msgpack_pack_array(out, (unsigned int)RARRAY_LEN(self));
  VALUE* p = RARRAY_PTR(self);
  VALUE* const pend = p + RARRAY_LEN(self);
  for(;p != pend; ++p) {
    rb_funcall(*p, s_to_msgpack, 1, out);
  }
  return out;
}