Class: VirtualBox::COM::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/virtualbox/com/util.rb

Class Method Summary collapse

Class Method Details

.interface?(name) ⇒ Boolean

Returns a boolean true/false whether the given COM interface exists.

Returns:

  • (Boolean)


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_constObject

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