Module: FFI::DataConverter
- Included in:
- AutoPointer, Enum, StrPtrConverter, StructByReference
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/data_converter.rb
Overview
This module is used to extend somes classes and give then a common API.
Most of methods defined here must be overriden.
Instance Method Summary collapse
-
#from_native(value, ctx) ⇒ Object
Convert from a native type.
-
#native_type(type = nil) ⇒ Object
Get native type.
-
#to_native(value, ctx) ⇒ Object
Convert to a native type.
Instance Method Details
#from_native(value, ctx) ⇒ Object
Convert from a native type.
63 64 65 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/data_converter.rb', line 63 def from_native(value, ctx) value end |
#native_type(type) ⇒ Type #native_type ⇒ Object
Get native type.
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/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 |
#to_native(value, ctx) ⇒ Object
Convert to a native type.
58 59 60 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/data_converter.rb', line 58 def to_native(value, ctx) value end |