Class: RAPI::Native::CEHandle

Inherits:
FFI::Pointer
  • Object
show all
Extended by:
FFI::DataConverter
Defined in:
lib/rapi.rb

Defined Under Namespace

Classes: Finalizer

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (CEHandle) initialize(handle)

Returns a new instance of CEHandle



642
643
644
645
646
# File 'lib/rapi.rb', line 642

def initialize(handle)
  @finalizer = Finalizer.new(handle)
  ObjectSpace.define_finalizer(self, @finalizer)
  super handle
end

Class Method Details

+ (Object) from_native(val, ctx)



634
635
636
# File 'lib/rapi.rb', line 634

def self.from_native(val, ctx)
  new(val.address)
end

+ (Object) to_native(val, ctx)



638
639
640
# File 'lib/rapi.rb', line 638

def self.to_native(val, ctx)
  FFI::Pointer.new(val.address)
end

Instance Method Details

- (Object) close



656
657
658
# File 'lib/rapi.rb', line 656

def close
  @finalizer.call
end

- (Boolean) invalid?

Returns:

  • (Boolean)


652
653
654
# File 'lib/rapi.rb', line 652

def invalid?
  !valid?
end

- (Boolean) valid?

Returns:

  • (Boolean)


648
649
650
# File 'lib/rapi.rb', line 648

def valid?
  self != INVALID_HANDLE
end