Class: Libvirt::NetworkDhcpLease

Inherits:
BaseInfo
  • Object
show all
Defined in:
lib/libvirt/network_dhcp_lease.rb

Instance Method Summary collapse

Methods inherited from BaseInfo

#[], struct_class, #to_h, #to_ptr

Constructor Details

#initialize(pointer) ⇒ NetworkDhcpLease

Returns a new instance of NetworkDhcpLease.

Parameters:

  • pointer (FFI::Pointer)


8
9
10
11
12
13
14
15
16
17
18
# File 'lib/libvirt/network_dhcp_lease.rb', line 8

def initialize(pointer)
  super

  free = ->(obj_id) do
    dbg { "Finalize Libvirt::NetworkDhcpLease object_id=0x#{obj_id.to_s(16)}, pointer=0x#{@ptr.address.to_s(16)}" }
    return unless @ptr

    warn "Couldn't free Libvirt::NetworkDhcpLease object_id=0x#{obj_id.to_s(16)}, pointer=0x#{@ptr.address.to_s(16)}" if FFI::Storage.virNetworkDHCPLeaseFree(@ptr).negative?
  end
  ObjectSpace.define_finalizer(self, free)
end