Class: DCloud::InstanceProfile
- Inherits:
-
Object
- Object
- DCloud::InstanceProfile
- Defined in:
- lib/dcloud/instance.rb
Instance Attribute Summary collapse
-
#hardware_profile ⇒ Object
readonly
Returns the value of attribute hardware_profile.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #[](prop) ⇒ Object
-
#initialize(client, xml) ⇒ InstanceProfile
constructor
A new instance of InstanceProfile.
- #property(prop) ⇒ Object
Constructor Details
#initialize(client, xml) ⇒ InstanceProfile
Returns a new instance of InstanceProfile.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dcloud/instance.rb', line 26 def initialize(client, xml) @hardware_profile = HardwareProfile.new(client, xml.attributes['href']) @properties = {} @id = xml.text("id") xml.get_elements('property').each do |prop| @properties[prop.attributes['name'].to_sym] = { :value => prop.attributes['value'], :unit => prop.attributes['unit'], :kind => prop.attributes['kind'].to_sym } end end |
Instance Attribute Details
#hardware_profile ⇒ Object (readonly)
Returns the value of attribute hardware_profile.
24 25 26 |
# File 'lib/dcloud/instance.rb', line 24 def hardware_profile @hardware_profile end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
24 25 26 |
# File 'lib/dcloud/instance.rb', line 24 def id @id end |
Instance Method Details
#[](prop) ⇒ Object
39 40 41 42 |
# File 'lib/dcloud/instance.rb', line 39 def [](prop) p = @properties[prop] p ? p[:value] : nil end |
#property(prop) ⇒ Object
44 45 46 |
# File 'lib/dcloud/instance.rb', line 44 def property(prop) @properties[prop] end |