Class: FFI::StructLayout::CharArray

Inherits:
FFI::Struct::InlineArray show all
Defined in:
ext/ffi_c/Struct.c

Instance Method Summary collapse

Methods inherited from FFI::Struct::InlineArray

#[], #[]=, #each, #initialize, #size, #to_a, #to_ptr

Constructor Details

This class inherits a constructor from FFI::Struct::InlineArray

Instance Method Details

#to_sString Also known as: to_str

Convert self to a string.

Returns:



709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
# File 'ext/ffi_c/Struct.c', line 709

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);
}