Class: VirtualBox::COM::Util
- Inherits:
-
Object
- Object
- VirtualBox::COM::Util
- Defined in:
- lib/virtualbox/com/util.rb
Class Method Summary collapse
-
.interface?(name) ⇒ Boolean
Returns a boolean true/false whether the given COM interface exists.
- .set_interface_version(version) ⇒ Object
-
.version_const ⇒ Object
Returns a namespace representation for a version.
-
.versioned_interface(interface) ⇒ Object
Gets an interface within the current version namespace.
Class Method Details
.interface?(name) ⇒ Boolean
Returns a boolean true/false whether the given COM interface exists.
9 10 11 12 13 14 |
# File 'lib/virtualbox/com/util.rb', line 9 def interface?(name) COM::Interface.const_get(name.to_sym) true rescue NameError false end |
.set_interface_version(version) ⇒ Object
26 27 28 |
# File 'lib/virtualbox/com/util.rb', line 26 def set_interface_version(version) @__version = version end |
.version_const ⇒ Object
Returns a namespace representation for a version.
22 23 24 |
# File 'lib/virtualbox/com/util.rb', line 22 def version_const "Version_" + @__version.upcase.gsub(".", "_") end |
.versioned_interface(interface) ⇒ Object
Gets an interface within the current version namespace.
17 18 19 |
# File 'lib/virtualbox/com/util.rb', line 17 def versioned_interface(interface) Object.module_eval("::VirtualBox::COM::Interface::#{version_const}::#{interface}") end |