Class: FFI::StructLayout::Mapped
- Inherits:
-
Field
- Object
- Field
- FFI::StructLayout::Mapped
- Defined in:
- lib/ffi/struct_layout.rb
Instance Method Summary collapse
- #get(ptr) ⇒ Object
-
#initialize(name, offset, type, orig_field) ⇒ Mapped
constructor
A new instance of Mapped.
- #put(ptr, value) ⇒ Object
Constructor Details
#initialize(name, offset, type, orig_field) ⇒ Mapped
Returns a new instance of Mapped.
82 83 84 85 |
# File 'lib/ffi/struct_layout.rb', line 82 def initialize(name, offset, type, orig_field) @orig_field = orig_field super(name, offset, type) end |
Instance Method Details
#get(ptr) ⇒ Object
87 88 89 |
# File 'lib/ffi/struct_layout.rb', line 87 def get(ptr) type.from_native(@orig_field.get(ptr), nil) end |
#put(ptr, value) ⇒ Object
91 92 93 |
# File 'lib/ffi/struct_layout.rb', line 91 def put(ptr, value) @orig_field.put(ptr, type.to_native(value, nil)) end |