Class: Fog::Compute::VirtualBox::StorageControllers

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/compute/models/virtual_box/storage_controllers.rb

Instance Attribute Summary collapse

Attributes inherited from Fog::Collection

#connection

Instance Method Summary collapse

Methods inherited from Fog::Collection

#clear, #create, #initialize, #inspect, #load, model, #model, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Attribute Details

#machineObject

Returns the value of attribute machine.



12
13
14
# File 'lib/fog/compute/models/virtual_box/storage_controllers.rb', line 12

def machine
  @machine
end

Instance Method Details

#allObject



14
15
16
17
18
19
20
# File 'lib/fog/compute/models/virtual_box/storage_controllers.rb', line 14

def all
  requires :machine
  data = machine.instance_variable_get(:@raw).storage_controllers.map do |storage_controller|
    {:raw => storage_controller}
  end
  load(data)
end

#get(storage_controller_name) ⇒ Object



22
23
24
25
26
27
# File 'lib/fog/compute/models/virtual_box/storage_controllers.rb', line 22

def get(storage_controller_name)
  requires :machine
  all.detect do |storage_controller|
    storage_controller.name == storage_controller_name
  end
end

#new(attributes = {}) ⇒ Object



29
30
31
32
# File 'lib/fog/compute/models/virtual_box/storage_controllers.rb', line 29

def new(attributes = {})
  requires :machine
  super({ :machine => machine }.merge!(attributes))
end