Class: Fog::Compute::Vsphere::Volume
- Defined in:
- lib/fog/vsphere/models/compute/volume.rb
Constant Summary collapse
- DISK_SIZE_TO_GB =
1048576
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Volume
constructor
A new instance of Volume.
- #size_gb ⇒ Object
- #size_gb=(s) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
#initialize(attributes = {}) ⇒ Volume
Returns a new instance of Volume.
17 18 19 |
# File 'lib/fog/vsphere/models/compute/volume.rb', line 17 def initialize(attributes={} ) super defaults.merge(attributes) end |
Instance Method Details
#size_gb ⇒ Object
21 22 23 |
# File 'lib/fog/vsphere/models/compute/volume.rb', line 21 def size_gb attributes[:size_gb] ||= attributes[:size].to_i / DISK_SIZE_TO_GB if attributes[:size] end |
#size_gb=(s) ⇒ Object
25 26 27 |
# File 'lib/fog/vsphere/models/compute/volume.rb', line 25 def size_gb= s attributes[:size] = s.to_i * DISK_SIZE_TO_GB if s end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/fog/vsphere/models/compute/volume.rb', line 29 def to_s name end |