Class: VirtualBox::COM::AbstractEnum

Inherits:
Object
  • Object
show all
Extended by:
Enumerable
Defined in:
lib/virtualbox/com/abstract_enum.rb

Overview

Represents a C enum type. Provides functionality to easily convert an int value to its proper symbol within the enum.

Direct Known Subclasses

Interface::Version_3_1_X::AudioControllerType, Interface::Version_3_1_X::AudioDriverType, Interface::Version_3_1_X::BIOSBootMenuMode, Interface::Version_3_1_X::ClipboardMode, Interface::Version_3_1_X::CpuPropertyType, Interface::Version_3_1_X::DeviceType, Interface::Version_3_1_X::FirmwareType, Interface::Version_3_1_X::HWVirtExPropertyType, Interface::Version_3_1_X::HostNetworkInterfaceMediumType, Interface::Version_3_1_X::HostNetworkInterfaceStatus, Interface::Version_3_1_X::HostNetworkInterfaceType, Interface::Version_3_1_X::MachineState, Interface::Version_3_1_X::MediumState, Interface::Version_3_1_X::MediumType, Interface::Version_3_1_X::MediumVariant, Interface::Version_3_1_X::NetworkAdapterType, Interface::Version_3_1_X::NetworkAttachmentType, Interface::Version_3_1_X::PortMode, Interface::Version_3_1_X::SessionState, Interface::Version_3_1_X::SessionType, Interface::Version_3_1_X::StorageBus, Interface::Version_3_1_X::StorageControllerType, Interface::Version_3_1_X::USBDeviceFilterAction, Interface::Version_3_1_X::USBDeviceState, Interface::Version_3_1_X::VRDPAuthType, Interface::Version_3_1_X::VirtualSystemDescriptionType, Interface::Version_3_1_X::VirtualSystemDescriptionValueType, Interface::Version_3_2_X::AccessMode, Interface::Version_3_2_X::AudioControllerType, Interface::Version_3_2_X::AudioDriverType, Interface::Version_3_2_X::BIOSBootMenuMode, Interface::Version_3_2_X::ClipboardMode, Interface::Version_3_2_X::CpuPropertyType, Interface::Version_3_2_X::DeviceType, Interface::Version_3_2_X::FirmwareType, Interface::Version_3_2_X::HWVirtExPropertyType, Interface::Version_3_2_X::HostNetworkInterfaceMediumType, Interface::Version_3_2_X::HostNetworkInterfaceStatus, Interface::Version_3_2_X::HostNetworkInterfaceType, Interface::Version_3_2_X::KeyboardHidType, Interface::Version_3_2_X::MachineState, Interface::Version_3_2_X::MediumState, Interface::Version_3_2_X::MediumType, Interface::Version_3_2_X::MediumVariant, Interface::Version_3_2_X::NATAliasMode, Interface::Version_3_2_X::NATProtocol, Interface::Version_3_2_X::NetworkAdapterType, Interface::Version_3_2_X::NetworkAttachmentType, Interface::Version_3_2_X::PointingHidType, Interface::Version_3_2_X::PortMode, Interface::Version_3_2_X::SessionState, Interface::Version_3_2_X::SessionType, Interface::Version_3_2_X::StorageBus, Interface::Version_3_2_X::StorageControllerType, Interface::Version_3_2_X::USBDeviceFilterAction, Interface::Version_3_2_X::USBDeviceState, Interface::Version_3_2_X::VRDPAuthType, Interface::Version_3_2_X::VirtualSystemDescriptionType, Interface::Version_3_2_X::VirtualSystemDescriptionValueType, Interface::Version_4_0_X::AccessMode, Interface::Version_4_0_X::AudioControllerType, Interface::Version_4_0_X::AudioDriverType, Interface::Version_4_0_X::AuthType, Interface::Version_4_0_X::BIOSBootMenuMode, Interface::Version_4_0_X::CleanupMode, Interface::Version_4_0_X::ClipboardMode, Interface::Version_4_0_X::CpuPropertyType, Interface::Version_4_0_X::DeviceType, Interface::Version_4_0_X::FaultToleranceState, Interface::Version_4_0_X::FirmwareType, Interface::Version_4_0_X::HWVirtExPropertyType, Interface::Version_4_0_X::HostNetworkInterfaceMediumType, Interface::Version_4_0_X::HostNetworkInterfaceStatus, Interface::Version_4_0_X::HostNetworkInterfaceType, Interface::Version_4_0_X::KeyboardHidType, Interface::Version_4_0_X::LockType, Interface::Version_4_0_X::MachineState, Interface::Version_4_0_X::MediumState, Interface::Version_4_0_X::MediumType, Interface::Version_4_0_X::MediumVariant, Interface::Version_4_0_X::NATAliasMode, Interface::Version_4_0_X::NATProtocol, Interface::Version_4_0_X::NetworkAdapterType, Interface::Version_4_0_X::NetworkAttachmentType, Interface::Version_4_0_X::PointingHidType, Interface::Version_4_0_X::PortMode, Interface::Version_4_0_X::SessionState, Interface::Version_4_0_X::SessionType, Interface::Version_4_0_X::StorageBus, Interface::Version_4_0_X::StorageControllerType, Interface::Version_4_0_X::USBDeviceFilterAction, Interface::Version_4_0_X::USBDeviceState, Interface::Version_4_0_X::VirtualSystemDescriptionType, Interface::Version_4_0_X::VirtualSystemDescriptionValueType

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object

Returns the symbol associatd with the given key



19
20
21
# File 'lib/virtualbox/com/abstract_enum.rb', line 19

def [](key)
  @map[key]
end

.eachObject

Iterate over the enum, yielding each item to a block.



29
30
31
32
33
# File 'lib/virtualbox/com/abstract_enum.rb', line 29

def each
  @map.each do |key|
    yield key
  end
end

.index(key) ⇒ Object

Returns the index associated with a value



24
25
26
# File 'lib/virtualbox/com/abstract_enum.rb', line 24

def index(key)
  @map.index(key)
end

.map(value = nil) ⇒ Object

Defines the mapping of int => symbol for the given Enum. The parameter to this can be an Array or Hash or anything which can be indexed with ‘[]` and an integer and returns a value of some sort. If value is left nil, it will return the current mapping



13
14
15
16
# File 'lib/virtualbox/com/abstract_enum.rb', line 13

def map(value = nil)
  @map = value if value
  @map
end

.reset!Object

Provided mostly for testing purposes only, but resets the mapping to nil.



37
38
39
# File 'lib/virtualbox/com/abstract_enum.rb', line 37

def reset!
  @map = nil
end