Class: Hakuban::FFI::FFIObjectDescriptor
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Hakuban::FFI::FFIObjectDescriptor
- Defined in:
- lib/hakuban/ffi.rb
Instance Attribute Summary collapse
-
#tags_strings ⇒ Object
Returns the value of attribute tags_strings.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#tags_strings ⇒ Object
Returns the value of attribute tags_strings.
73 74 75 |
# File 'lib/hakuban/ffi.rb', line 73 def @tags_strings end |
Class Method Details
.construct(tags, json) ⇒ Object
83 84 85 86 87 88 89 90 91 |
# File 'lib/hakuban/ffi.rb', line 83 def self.construct(,json) descriptor = FFIObjectDescriptor.new descriptor[:tags_count] = .size descriptor. = .map { |tag| FFI::MemoryPointer.from_string(JSON.dump(tag)) } descriptor[:tags] = FFI::MemoryPointer.new(:pointer, descriptor..size) descriptor[:tags].write_array_of_pointer(descriptor.) descriptor[:json] = FFI::MemoryPointer.from_string(JSON.dump(json)) descriptor end |
Instance Method Details
#json ⇒ Object
79 80 81 |
# File 'lib/hakuban/ffi.rb', line 79 def json JSON.parse(self[:json].read_string()) end |
#tags ⇒ Object
75 76 77 |
# File 'lib/hakuban/ffi.rb', line 75 def self[:tags].read_array_of_pointer(self[:tags_count]).map { |string| JSON.parse(string.read_string()) } # does this copy the string? end |