Class: LIBUSB::Call::Transfer
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- LIBUSB::Call::Transfer
- Defined in:
- lib/libusb/call.rb
Instance Method Summary collapse
-
#initialize ⇒ Transfer
constructor
A new instance of Transfer.
Constructor Details
#initialize ⇒ Transfer
Returns a new instance of Transfer.
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
# File 'lib/libusb/call.rb', line 636 def initialize(*) super ptr = pointer # @private # called by GC def ptr.free_struct(id) Call.libusb_free_transfer(self) return unless @ctx @ctx.unref_context end # The ctx pointer is not yet assigned. # It happens at LIBUSB::Transfer#dev_handle= later on. ptr.instance_variable_set(:@ctx, nil) ObjectSpace.define_finalizer(self, ptr.method(:free_struct)) end |