Class: Libvirt::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/libvirt.rb,
ext/libvirt/_libvirt.c

Overview

A version in Libvirt’s representation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, version) ⇒ Version

Returns a new instance of Version.



19
20
21
22
# File 'lib/libvirt.rb', line 19

def initialize(type, version)
    @type = type
    @version = version
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



17
18
19
# File 'lib/libvirt.rb', line 17

def type
  @type
end

#versionObject (readonly)

Returns the value of attribute version.



17
18
19
# File 'lib/libvirt.rb', line 17

def version
  @version
end

Instance Method Details

#majorObject



24
25
26
# File 'lib/libvirt.rb', line 24

def major
    version / 1000000
end

#minorObject



28
29
30
# File 'lib/libvirt.rb', line 28

def minor
    version % 1000000 / 1000
end

#releaseObject



32
33
34
# File 'lib/libvirt.rb', line 32

def release
    version % 1000
end

#to_sObject



36
37
38
# File 'lib/libvirt.rb', line 36

def to_s
    "#{major}.#{minor}.#{release}"
end