From 52c7c736ae87955d85e1ff746f6f5b7a57ce7a4e Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Mon, 6 Mar 2023 10:40:20 +0100 Subject: Fix `Type#inspect` to properly display the constant name before: ```ruby >> FFI::Type::Builtin::CHAR => # ``` after: ```ruby >> FFI::Type::Builtin::CHAR => # ``` --- ext/ffi_c/Type.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/ffi_c/Type.c b/ext/ffi_c/Type.c index 259ae97..d940e94 100644 --- a/ext/ffi_c/Type.c +++ b/ext/ffi_c/Type.c @@ -157,7 +157,7 @@ type_inspect(VALUE self) TypedData_Get_Struct(self, Type, &rbffi_type_data_type, type); - snprintf(buf, sizeof(buf), "#<%s:%p size=%d alignment=%d>", + snprintf(buf, sizeof(buf), "#<%s::%p size=%d alignment=%d>", rb_obj_classname(self), type, (int) type->ffiType->size, (int) type->ffiType->alignment); return rb_str_new2(buf); @@ -198,7 +198,7 @@ builtin_type_inspect(VALUE self) BuiltinType *type; TypedData_Get_Struct(self, BuiltinType, &builtin_type_data_type, type); - snprintf(buf, sizeof(buf), "#<%s:%s size=%d alignment=%d>", + snprintf(buf, sizeof(buf), "#<%s::%s size=%d alignment=%d>", rb_obj_classname(self), type->name, (int) type->type.ffiType->size, type->type.ffiType->alignment); return rb_str_new2(buf); -- cgit v1.2.1