Class: DCloud::HardwareProfile
- Defined in:
- lib/dcloud/hardware_profile.rb
Defined Under Namespace
Classes: FloatProperty, IntegerProperty, Property
Instance Attribute Summary
Attributes inherited from BaseModel
Instance Method Summary collapse
-
#initialize(client, uri, xml = nil) ⇒ HardwareProfile
constructor
A new instance of HardwareProfile.
- #load_payload(xml = nil) ⇒ Object
- #to_plain ⇒ Object
Methods inherited from BaseModel
attribute, build_reader, #id, xml_tag_name
Constructor Details
#initialize(client, uri, xml = nil) ⇒ HardwareProfile
Returns a new instance of HardwareProfile.
99 100 101 |
# File 'lib/dcloud/hardware_profile.rb', line 99 def initialize(client, uri, xml=nil) super( client, uri, xml ) end |
Instance Method Details
#load_payload(xml = nil) ⇒ Object
103 104 105 106 107 108 109 110 111 |
# File 'lib/dcloud/hardware_profile.rb', line 103 def load_payload(xml=nil) super(xml) unless xml.nil? @memory = FloatProperty.new(xml, 'memory') @storage = FloatProperty.new(xml, 'storage') @cpu = IntegerProperty.new(xml, 'cpu') @architecture = Property.new(xml, 'architecture') end end |
#to_plain ⇒ Object
113 114 115 116 |
# File 'lib/dcloud/hardware_profile.rb', line 113 def to_plain sprintf("%-15s | %-6s | %10s | %10s ", id[0, 15], architecture.to_s[0,6], memory.to_s[0,10], storage.to_s[0,10]) end |