Class: FFI::StructLayout::CharArray

Inherits:
StructInlineArrayClass
  • Object
show all
Defined in:
ext/ffi_c/Struct.c

Instance Method Summary collapse

Instance Method Details

#to_sObject Also known as: to_str



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
# File 'ext/ffi_c/Struct.c', line 609

static VALUE
inline_array_to_s(VALUE self)
{
    InlineArray* array;
    VALUE argv[2];

    Data_Get_Struct(self, InlineArray, array);
 
    if (array->componentType->nativeType != NATIVE_INT8 && array->componentType->nativeType != NATIVE_UINT8) {
        VALUE dummy = Qnil;
        return rb_call_super(0, &dummy);
    }

    argv[0] = UINT2NUM(array->field->offset);
    argv[1] = UINT2NUM(array->length);

    return rb_funcall2(array->rbMemory, rb_intern("get_string"), 2, argv);
}