Class: VBOX::VM
- Inherits:
-
Object
- Object
- VBOX::VM
- Defined in:
- lib/vbox/vm.rb
Instance Attribute Summary collapse
-
#all_vars ⇒ Object
Returns the value of attribute all_vars.
-
#dir_size ⇒ Object
Returns the value of attribute dir_size.
-
#memory_size ⇒ Object
Returns the value of attribute memory_size.
-
#name ⇒ Object
Returns the value of attribute name.
-
#state ⇒ Object
Returns the value of attribute state.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
- #clone!(params) ⇒ Object
-
#initialize ⇒ VM
constructor
A new instance of VM.
Constructor Details
#initialize ⇒ VM
Returns a new instance of VM.
5 6 7 |
# File 'lib/vbox/vm.rb', line 5 def initialize @all_vars = {} end |
Instance Attribute Details
#all_vars ⇒ Object
Returns the value of attribute all_vars.
3 4 5 |
# File 'lib/vbox/vm.rb', line 3 def all_vars @all_vars end |
#dir_size ⇒ Object
Returns the value of attribute dir_size.
3 4 5 |
# File 'lib/vbox/vm.rb', line 3 def dir_size @dir_size end |
#memory_size ⇒ Object
Returns the value of attribute memory_size.
3 4 5 |
# File 'lib/vbox/vm.rb', line 3 def memory_size @memory_size end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/vbox/vm.rb', line 3 def name @name end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/vbox/vm.rb', line 3 def state @state end |
#uuid ⇒ Object
Returns the value of attribute uuid.
3 4 5 |
# File 'lib/vbox/vm.rb', line 3 def uuid @uuid end |
Class Method Details
.find(name_or_uuid) ⇒ Object Also known as: []
54 55 56 |
# File 'lib/vbox/vm.rb', line 54 def find name_or_uuid VBOX.api.get_vm_details name_or_uuid end |
.first ⇒ Object
50 51 52 |
# File 'lib/vbox/vm.rb', line 50 def first all.first end |
Instance Method Details
#clone!(params) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/vbox/vm.rb', line 15 def clone! params raise "argument must be a Hash" unless params.is_a?(Hash) raise "no :snapshot key" unless params[:snapshot] r = VBOX.api.clone self.name, params case r when Array if r.first.is_a?(VM) r else r.map{ |name| VM.find(name) } end when String VM.find(r) when nil nil else r end end |