Class: Cloud::InstanceType
- Inherits:
-
Object
- Object
- Cloud::InstanceType
- Defined in:
- lib/cloud/instancetype.rb,
lib/cloud/instancetype/version.rb
Overview
Describe a public cloud instance type
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#ram_bytes ⇒ Object
readonly
Returns the value of attribute ram_bytes.
-
#ram_si_units ⇒ Object
readonly
Returns the value of attribute ram_si_units.
-
#sort_value ⇒ Object
readonly
Returns the value of attribute sort_value.
-
#vcpu_count ⇒ Object
readonly
Returns the value of attribute vcpu_count.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(key, raw_data) ⇒ InstanceType
constructor
A new instance of InstanceType.
Constructor Details
#initialize(key, raw_data) ⇒ InstanceType
Returns a new instance of InstanceType.
10 11 12 13 14 15 16 17 18 |
# File 'lib/cloud/instancetype.rb', line 10 def initialize(key, raw_data) @key = key @sort_value = raw_data["sort_value"] @category = Cloud::InstanceCategory.new(raw_data["category"]) @vcpu_count = raw_data["vcpu_count"] @ram_bytes = raw_data["ram_bytes"] @ram_si_units = raw_data["ram_si_units"] @details = raw_data["details"] end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
7 8 9 |
# File 'lib/cloud/instancetype.rb', line 7 def category @category end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
7 8 9 |
# File 'lib/cloud/instancetype.rb', line 7 def details @details end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/cloud/instancetype.rb', line 7 def key @key end |
#ram_bytes ⇒ Object (readonly)
Returns the value of attribute ram_bytes.
7 8 9 |
# File 'lib/cloud/instancetype.rb', line 7 def ram_bytes @ram_bytes end |
#ram_si_units ⇒ Object (readonly)
Returns the value of attribute ram_si_units.
7 8 9 |
# File 'lib/cloud/instancetype.rb', line 7 def ram_si_units @ram_si_units end |
#sort_value ⇒ Object (readonly)
Returns the value of attribute sort_value.
7 8 9 |
# File 'lib/cloud/instancetype.rb', line 7 def sort_value @sort_value end |
#vcpu_count ⇒ Object (readonly)
Returns the value of attribute vcpu_count.
7 8 9 |
# File 'lib/cloud/instancetype.rb', line 7 def vcpu_count @vcpu_count end |
Class Method Details
.for(cloud) ⇒ Object
25 26 27 |
# File 'lib/cloud/instancetype.rb', line 25 def for(cloud) load(rails_data_path(cloud)) end |
.load(data_path) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/cloud/instancetype.rb', line 29 def load(data_path) raw_collection = get_raw_collection(data_path) instance_type_collection_factory( raw_collection["instance_types"], raw_collection["categories"] ) end |
Instance Method Details
#<=>(other) ⇒ Object
20 21 22 |
# File 'lib/cloud/instancetype.rb', line 20 def <=>(other) sort_value <=> other.sort_value end |