class Fiddle::Pinned
公共类方法
new(object) 点击以切换源代码
# File fiddle/lib/fiddle/ffi_backend.rb, line 557 def initialize(object) @object = object end
Fiddle::Pinned.new(object) → pinned_object 点击以切换源代码
创建一个新的固定对象引用。Fiddle::Pinned
实例将阻止垃圾回收器移动 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; }
公共实例方法
clear() 点击以切换源代码
清除对此固定对象的引用。
# File fiddle/lib/fiddle/ffi_backend.rb, line 568 def clear @object = nil end
cleared?() 点击以切换源代码
如果引用已被清除,则返回 true,否则返回 false。
# File fiddle/lib/fiddle/ffi_backend.rb, line 572 def cleared? @object.nil? end
ref() 点击以切换源代码
返回此固定实例引用的对象。
# File fiddle/lib/fiddle/ffi_backend.rb, line 561 def ref if @object.nil? raise ClearedReferenceError, "`ref` called on a cleared object" end @object end