Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#to_msgpack(*args) ⇒ Object
call-seq: array.to_msgpack(out = ”) -> String.
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.
214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'ext/pack.c', line 214
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;
}
|