Method: FFI::Pointer#read_type
- Defined in:
- lib/ffi_pointer.rb
#read_type(type) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/ffi_pointer.rb', line 6 def read_type(type) type = FFI.find_type(type) if type.is_a?(Symbol) type = type.native_type if type.is_a?(FFI::Type::Mapped) raise ArgumentError, "Can only read built-in types (type=#{type})" unless type.is_a?(FFI::Type::Builtin) name = type.inspect.match(/<#{type.class}:(\S+)/)[1].downcase method = "read_#{name}".to_sym self.send(method) end |