Flowdock
new(...) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
/*
 */

static VALUE
rb_struct_initialize(self, values)
    VALUE self, values;
{
    VALUE klass = rb_obj_class(self);
    VALUE size;
    long n;

    rb_struct_modify(self);
    size = rb_struct_iv_get(klass, "__size__");
    n = FIX2LONG(size);
    if (n < RARRAY(values)->len) {
        rb_raise(rb_eArgError, "struct size differs");
    }
    MEMCPY(RSTRUCT(self)->ptr, RARRAY(values)->ptr, VALUE, RARRAY(values)->len);
    if (n > RARRAY(values)->len) {
        rb_mem_clear(RSTRUCT(self)->ptr+RARRAY(values)->len,
                     n-RARRAY(values)->len);
    }
    return Qnil;
}
Register or log in to add new notes.