Class: Libvirt::Version
- Inherits:
-
Object
- Object
- Libvirt::Version
- Defined in:
- lib/libvirt.rb,
ext/libvirt/_libvirt.c
Overview
A version in Libvirt’s representation
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(type, version) ⇒ Version
constructor
A new instance of Version.
- #major ⇒ Object
- #minor ⇒ Object
- #release ⇒ Object
- #to_s ⇒ Object
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
#type ⇒ Object (readonly)
Returns the value of attribute type.
17 18 19 |
# File 'lib/libvirt.rb', line 17 def type @type end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
17 18 19 |
# File 'lib/libvirt.rb', line 17 def version @version end |
Instance Method Details
#major ⇒ Object
24 25 26 |
# File 'lib/libvirt.rb', line 24 def major version / 1000000 end |
#minor ⇒ Object
28 29 30 |
# File 'lib/libvirt.rb', line 28 def minor version % 1000000 / 1000 end |
#release ⇒ Object
32 33 34 |
# File 'lib/libvirt.rb', line 32 def release version % 1000 end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/libvirt.rb', line 36 def to_s "#{major}.#{minor}.#{release}" end |