Class: Deltacloud::InstanceProfile
- Defined in:
- lib/deltacloud/models/instance_profile.rb
Instance Attribute Summary collapse
-
#architecture ⇒ Object
Returns the value of attribute architecture.
-
#cpu ⇒ Object
Returns the value of attribute cpu.
-
#memory ⇒ Object
Returns the value of attribute memory.
-
#storage ⇒ Object
Returns the value of attribute storage.
Attributes inherited from BaseModel
Instance Method Summary collapse
-
#initialize(hwp_name, args = {}) ⇒ InstanceProfile
constructor
A new instance of InstanceProfile.
- #name ⇒ Object
- #override?(property) ⇒ Boolean
- #overrides ⇒ Object
- #to_s ⇒ Object
Methods inherited from BaseModel
attr_accessor, attributes, #attributes, #id, #to_entity
Constructor Details
#initialize(hwp_name, args = {}) ⇒ InstanceProfile
Returns a new instance of InstanceProfile.
27 28 29 30 31 32 33 34 |
# File 'lib/deltacloud/models/instance_profile.rb', line 27 def initialize(hwp_name, args = {}) opts = args.inject({ :id => hwp_name.to_s }) do |m, e| k, v = e m[$1] = v if k.to_s =~ /^hwp_(.*)$/ m end super(opts) end |
Instance Attribute Details
#architecture ⇒ Object
Returns the value of attribute architecture.
24 25 26 |
# File 'lib/deltacloud/models/instance_profile.rb', line 24 def architecture @architecture end |
#cpu ⇒ Object
Returns the value of attribute cpu.
25 26 27 |
# File 'lib/deltacloud/models/instance_profile.rb', line 25 def cpu @cpu end |
#memory ⇒ Object
Returns the value of attribute memory.
22 23 24 |
# File 'lib/deltacloud/models/instance_profile.rb', line 22 def memory @memory end |
#storage ⇒ Object
Returns the value of attribute storage.
23 24 25 |
# File 'lib/deltacloud/models/instance_profile.rb', line 23 def storage @storage end |
Instance Method Details
#name ⇒ Object
36 37 38 |
# File 'lib/deltacloud/models/instance_profile.rb', line 36 def name id end |
#override?(property) ⇒ Boolean
44 45 46 |
# File 'lib/deltacloud/models/instance_profile.rb', line 44 def override?(property) overrides.find { |p, v| p == property } end |
#overrides ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/deltacloud/models/instance_profile.rb', line 48 def overrides [:memory, :storage, :architecture, :cpu].inject({}) do |h, p| if v = instance_variable_get("@#{p}") h[p] = v end h end end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/deltacloud/models/instance_profile.rb', line 40 def to_s name end |