Home » FFI master » Index (C) » StructLayoutClass » CharArray ▲
123456789_123456789_123456789_123456789_123456789_

Class: StructLayoutClass::CharArray

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
self, ::FFI::Struct::InlineArray, Enumerable
Inherits: FFI::Struct::InlineArray
Defined in: ext/ffi_c/Struct.c

Class Method Summary

Instance Method Summary

Constructor Details

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

Instance Method Details

#to_sString Convert(+self+ to a string.)
Also known as: #to_str

[ GitHub ]

  
# File 'ext/ffi_c/Struct.c', line 783

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

    TypedData_Get_Struct(self, InlineArray, &inline_array_data_type, 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);
}

#to_sString Convert(+self+ to a string.)

Alias for #to_s.