Make ffi type to getter/setter method search more robust to work in 1.8 and 1.9.
This commit is contained in:
		
							parent
							
								
									a21071b590
								
							
						
					
					
						commit
						893c457b35
					
				| 
						 | 
					@ -21,9 +21,10 @@ module ProcessShared
 | 
				
			||||||
      # See https://github.com/ffi/ffi/issues/118
 | 
					      # See https://github.com/ffi/ffi/issues/118
 | 
				
			||||||
      ffi_type = FFI.find_type(self.type)
 | 
					      ffi_type = FFI.find_type(self.type)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      name, _ = FFI::TypeDefs.find do |(name, t)|
 | 
					      name = if ffi_type.inspect =~ /FFI::Type::Builtin:(\w+)*/
 | 
				
			||||||
        t == ffi_type
 | 
					               # name will be something like int32
 | 
				
			||||||
      end
 | 
					               $1.downcase
 | 
				
			||||||
 | 
					             end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      unless name
 | 
					      unless name
 | 
				
			||||||
        raise ArgumentError, "could not find FFI::Type for #{self.type}"
 | 
					        raise ArgumentError, "could not find FFI::Type for #{self.type}"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue