/** * Document-method: MessagePack.pack * * call-seq: * MessagePack.pack(object, out = '') -> String * * Serializes the object into raw bytes. The encoding of the string is ASCII-8BIT on Ruby 1.9. * This method is same as object.to_msgpack(out = ''). * * _out_ is an object that implements *<<* method like String or IO. */ static VALUE MessagePack_pack(int argc, VALUE* argv, VALUE self) { VALUE out; if(argc == 1) { out = rb_str_buf_new(0); } else if(argc == 2) { out = argv[1]; } else { rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc); } return rb_funcall(argv[0], s_to_msgpack, 1, out); }