Method: FFI::Pointer#to_s
- Defined in:
- ext/ffi_c/Pointer.c
#inspect ⇒ String
Inspect pointer object.
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'ext/ffi_c/Pointer.c', line 264
static VALUE
ptr_inspect(VALUE self)
{
char buf[100];
Pointer* ptr;
TypedData_Get_Struct(self, Pointer, &rbffi_pointer_data_type, ptr);
if (ptr->memory.size != LONG_MAX) {
snprintf(buf, sizeof(buf), "#<%s address=%p size=%lu>",
rb_obj_classname(self), ptr->memory.address, ptr->memory.size);
} else {
snprintf(buf, sizeof(buf), "#<%s address=%p>", rb_obj_classname(self), ptr->memory.address);
}
return rb_str_new2(buf);
}
|