Sha256: 9c9160f60584e14676c30226175351906e582ca5495f054e16a8c71a7397be55
Contents?: true
Size: 1.7 KB
Versions: 22
Compression:
Stored size: 1.7 KB
Contents
module VirtualBox # Represents a USB controller within VirtualBox. This class is a relationship # to {VM} objects. class USBController < AbstractModel attribute :parent, :readonly => true, :property => false attribute :interface, :readonly => true, :property => false attribute :enabled, :boolean => true attribute :enabled_ehci, :boolean => true attribute :usb_standard, :readonly => true relationship :device_filters, :USBDeviceFilter class << self # Populates the USB controller relationship for anything # which is related to it. # # **This method typically won't be used except internally.** # # @return [USBController] def populate_relationship(caller, machine) new(caller, machine.usb_controller) end # Saves the relationship. This simply calls {#save} on the # relationship object. # # **This method typically won't be used except internally.** def save_relationship(caller, item) item.save end end def initialize(parent, iusb) initialize_attributes(parent, iusb) end def initialize_attributes(parent, iusb) # Write the parent and interface attributes write_attribute(:parent, parent) write_attribute(:interface, iusb) # Load the interface attributes load_interface_attributes(interface) # Setup the relationships populate_relationships(interface) # Clear dirty and mark as existing clear_dirty! existing_record! end # Saves the USB controller. def save parent.with_open_session do |session| save_changed_interface_attributes(session.machine.usb_controller) end end end end
Version data entries
22 entries across 22 versions & 3 rubygems