module FFI::DataConverter

This module is used to extend somes classes and give then a common API.

Most of methods defined here must be overridden.

Public Instance Methods

Convert from a native type.

# File lib/ffi/data_converter.rb, line 63
def from_native(value, ctx)
  value
end

Get native type.

@overload native_type(type)

@param [String, Symbol, Type] type
@return [Type]
Get native type from +type+.

@overload native_type

@raise {NotImplementedError} This method must be overridden.
# File lib/ffi/data_converter.rb, line 45
def native_type(type = nil)
  if type
    @native_type = FFI.find_type(type)
  else
    native_type = @native_type
    unless native_type
      raise NotImplementedError, 'native_type method not overridden and no native_type set'
    end
    native_type
  end
end

Convert to a native type.

# File lib/ffi/data_converter.rb, line 58
def to_native(value, ctx)
  value
end