From 893c457b359ba13ed96b74abd1344f7f48157a07 Mon Sep 17 00:00:00 2001 From: Patrick Mahoney Date: Wed, 21 Dec 2011 08:14:20 -0600 Subject: [PATCH] Make ffi type to getter/setter method search more robust to work in 1.8 and 1.9. --- lib/process_shared/shared_array.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/process_shared/shared_array.rb b/lib/process_shared/shared_array.rb index 5454663..92300e1 100644 --- a/lib/process_shared/shared_array.rb +++ b/lib/process_shared/shared_array.rb @@ -21,9 +21,10 @@ module ProcessShared # See https://github.com/ffi/ffi/issues/118 ffi_type = FFI.find_type(self.type) - name, _ = FFI::TypeDefs.find do |(name, t)| - t == ffi_type - end + name = if ffi_type.inspect =~ /FFI::Type::Builtin:(\w+)*/ + # name will be something like int32 + $1.downcase + end unless name raise ArgumentError, "could not find FFI::Type for #{self.type}"