Class: FFI::StructLayout::Mapped
Instance Method Summary collapse
- #get(ptr) ⇒ Object
-
#initialize(name, offset, type, orig_field) ⇒ Mapped
constructor
A new instance of Mapped.
- #put(ptr, value) ⇒ Object
Methods inherited from Field
#alignment, #name, #offset, #size, #type
Constructor Details
#initialize(name, offset, type, orig_field) ⇒ Mapped
Returns a new instance of Mapped.
85 86 87 88 |
# File 'lib/ffi/struct.rb', line 85 def initialize(name, offset, type, orig_field) super(name, offset, type) @orig_field = orig_field end |
Instance Method Details
#get(ptr) ⇒ Object
90 91 92 |
# File 'lib/ffi/struct.rb', line 90 def get(ptr) type.from_native(@orig_field.get(ptr), nil) end |
#put(ptr, value) ⇒ Object
94 95 96 |
# File 'lib/ffi/struct.rb', line 94 def put(ptr, value) @orig_field.put(ptr, type.to_native(value, nil)) end |