lib/ffi/struct_wrapper.rb in ffi-libfuse-0.4.0 vs lib/ffi/struct_wrapper.rb in ffi-libfuse-0.4.1

- old
+ new

@@ -25,17 +25,17 @@ def to_native(value, ctx) return Pointer::NULL if value.nil? value = value.native if value.is_a?(StructWrapper) - super(value, ctx) + super end def from_native(value, ctx) return nil if value.null? - native = super(value, ctx) + native = super @wrapper_class.new(native) end end # Additional class methods for StructWrapper @@ -98,15 +98,17 @@ @native = native end # Get attribute def [](member_or_attr) - @native[self.class.ffi_attr_readers.fetch(member_or_attr, member_or_attr)] + _attr, member = ffi_attr_reader_member(member_or_attr, member_or_attr) + @native[member] end # Set attribute def []=(member_or_attr, val) - @native[self.class.ffi_attr_writers.fetch(member_or_attr, member_or_attr)] = val + _attr, member = ffi_attr_writer_member(member_or_attr, member_or_attr) + @native[member] = val end # Pass unimplemented methods on to {#native} underlying struct def method_missing(method, *args) @native.send(method, *args)