Class: VirtualBox::COM::MSCOMInterface
- Inherits:
-
BaseInterface
- Object
- BaseInterface
- VirtualBox::COM::MSCOMInterface
- Defined in:
- lib/virtualbox/com/mscom_interface.rb
Instance Attribute Summary collapse
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#virtualbox ⇒ Object
readonly
The VirtualBox and Session interfaces, both of which are extremely important in interfacing with the VirtualBox API.
Instance Method Summary collapse
-
#initialize ⇒ MSCOMInterface
constructor
A new instance of MSCOMInterface.
- #initialize_for_version(version) ⇒ Object
- #initialize_mscom ⇒ Object
Methods inherited from BaseInterface
Constructor Details
#initialize ⇒ MSCOMInterface
Returns a new instance of MSCOMInterface.
11 12 13 14 |
# File 'lib/virtualbox/com/mscom_interface.rb', line 11 def initialize super initialize_mscom end |
Instance Attribute Details
#session ⇒ Object (readonly)
Returns the value of attribute session.
9 10 11 |
# File 'lib/virtualbox/com/mscom_interface.rb', line 9 def session @session end |
#virtualbox ⇒ Object (readonly)
The VirtualBox and Session interfaces, both of which are extremely important in interfacing with the VirtualBox API. Once these have been initialized, all other parts of the API can be accessed via these instances.
8 9 10 |
# File 'lib/virtualbox/com/mscom_interface.rb', line 8 def virtualbox @virtualbox end |
Instance Method Details
#initialize_for_version(version) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/virtualbox/com/mscom_interface.rb', line 25 def initialize_for_version(version) COM::Util.set_interface_version(version) @virtualbox = COM::Util.versioned_interface(:VirtualBox).new(Implementer::MSCOM, self, WIN32OLE.new("VirtualBox.VirtualBox")) @session = COM::Util.versioned_interface(:Session).new(Implementer::MSCOM, self, WIN32OLE.new("VirtualBox.Session")) vb_version = @virtualbox.version # Check if they match or not. return false if vb_version.length == version.length (0...(version.length)).each do |i| next if version[i,1] == "x" return false if version[i,1] != vb_version[i,1] end true end |
#initialize_mscom ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/virtualbox/com/mscom_interface.rb', line 16 def initialize_mscom require 'win32ole' interface_dir = File.(File.join(File.dirname(__FILE__), "interface")) Dir[File.join(interface_dir, "*")].each do |f| return if File.directory?(f) && initialize_for_version(File.basename(f)) end end |