Module: Libvirt::Ruby

Included in:
Connect
Defined in:
lib/libvirt-ruby-mapping.rb,
lib/libvirt-ruby-mapping/connect.rb,
lib/libvirt-ruby-mapping/version.rb

Defined Under Namespace

Modules: Connect, Mapping

Class Method Summary collapse

Class Method Details

.initializeObject



7
8
9
10
# File 'lib/libvirt-ruby-mapping.rb', line 7

def self.initialize
  virInitialize(:int) unless respond_to?(:virInitialize)
  virInitialize
end

.versionObject



12
13
14
15
16
17
18
# File 'lib/libvirt-ruby-mapping.rb', line 12

def self.version
  virGetVersion(:pointer, :string, :pointer, :int) unless respond_to?(:virGetVersion)
  p = FFI::MemoryPointer.new(:ulong)
  virGetVersion(p, nil, nil)
  version = p.get_ulong(0)
  "#{version / 1_000_000}.#{(version % 1_000_000) / 1_000}.#{(version % 1_000_000) %1000}"
end