lib/virtualbox/hw_virtualization.rb in virtualbox-0.6.1 vs lib/virtualbox/hw_virtualization.rb in virtualbox-0.7.0
- old
+ new
@@ -2,17 +2,17 @@
# Represents the HW virtualization properties on a VM.
class HWVirtualization < AbstractModel
attribute :parent, :readonly => true, :property => false
attribute_scope(:property_getter => Proc.new { |instance, *args| instance.get_property(*args) },
:property_setter => Proc.new { |instance, *args| instance.set_property(*args) }) do
- attribute :enabled
- attribute :exclusive
- attribute :vpid
- attribute :nested_paging
+ attribute :enabled, :boolean => true
+ attribute :exclusive, :boolean => true
+ attribute :vpid, :boolean => true
+ attribute :nested_paging, :boolean => true
end
- class <<self
+ class << self
# Populates a relationship with another model.
#
# **This method typically won't be used except internally.**
#
# @return [HWVirtualization]
@@ -43,15 +43,21 @@
def set_property(interface, key, value)
interface.set_hw_virt_ex_property(key, value)
end
+ def validate
+ super
+
+ validates_inclusion_of :enabled, :exclusive, :vpid, :nested_paging, :in => [true, false]
+ end
+
def save
parent.with_open_session do |session|
machine = session.machine
# Save them
save_changed_interface_attributes(machine)
end
end
end
-end
\ No newline at end of file
+end