class Fiddle::Pinned
Public Class Methods
new(object)
click to toggle source
# File fiddle/lib/fiddle/ffi_backend.rb, line 554 def initialize(object) @object = object end
Fiddle::Pinned.new(object) → pinned_object
click to toggle source
Create a new pinned object reference. The Fiddle::Pinned
instance will prevent the GC from moving object
.
static VALUE initialize(VALUE self, VALUE ref) { struct pinned_data *data; TypedData_Get_Struct(self, struct pinned_data, &pinned_data_type, data); RB_OBJ_WRITE(self, &data->ptr, ref); return self; }
Public Instance Methods
clear()
click to toggle source
Clear the reference to the object this is pinning.
# File fiddle/lib/fiddle/ffi_backend.rb, line 565 def clear @object = nil end
cleared?()
click to toggle source
Returns true if the reference has been cleared, otherwise returns false.
# File fiddle/lib/fiddle/ffi_backend.rb, line 569 def cleared? @object.nil? end
ref()
click to toggle source
Return the object that this pinned instance references.
# File fiddle/lib/fiddle/ffi_backend.rb, line 558 def ref if @object.nil? raise ClearedReferenceError, "`ref` called on a cleared object" end @object end