Module: FFI::Libvirt::Util

Defined in:
lib/ffi/libvirt/util.rb

Overview

Utility methods which may be helpful when dealing with the FFI layer.

Class Method Summary collapse

Class Method Details

.parse_version_number(number) ⇒ Array

Parses the raw version integer returned by various libvirt methods into proper [major, minor, patch] format.

Returns:

  • (Array)


9
10
11
12
13
14
15
16
# File 'lib/ffi/libvirt/util.rb', line 9

def self.parse_version_number(number)
  # Format is MAJOR * 1,000,000 + MINOR * 1,000 + PATCH
  major = number / 1_000_000
  number %= 1_000_000
  minor = number / 1_000
  number %= 1000
  [major, minor, number]
end