Class: OpenShift::Scaling
- Defined in:
- lib/openshift-origin-common/models/scaling.rb
Instance Attribute Summary collapse
-
#generated ⇒ Object
Returns the value of attribute generated.
-
#max ⇒ Object
Returns the value of attribute max.
-
#min ⇒ Object
Returns the value of attribute min.
Instance Method Summary collapse
- #from_descriptor(spec_hash = {}) ⇒ Object
-
#initialize ⇒ Scaling
constructor
A new instance of Scaling.
- #to_descriptor ⇒ Object
Methods inherited from Model
attr_accessor, attr_reader, attr_writer, #attributes, #attributes=, #deleted?, exclude_attributes, excludes_attributes, gen_uuid, include_attributes, includes_attributes, #new_record?, #persisted?, primary_key, require_update_attributes, requires_update_attributes, #reset_state, #to_xml
Constructor Details
#initialize ⇒ Scaling
Returns a new instance of Scaling.
5 6 7 8 |
# File 'lib/openshift-origin-common/models/scaling.rb', line 5 def initialize self.min = 1 self.max = -1 end |
Instance Attribute Details
#generated ⇒ Object
Returns the value of attribute generated.
3 4 5 |
# File 'lib/openshift-origin-common/models/scaling.rb', line 3 def generated @generated end |
#max ⇒ Object
Returns the value of attribute max.
3 4 5 |
# File 'lib/openshift-origin-common/models/scaling.rb', line 3 def max @max end |
#min ⇒ Object
Returns the value of attribute min.
3 4 5 |
# File 'lib/openshift-origin-common/models/scaling.rb', line 3 def min @min end |
Instance Method Details
#from_descriptor(spec_hash = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/openshift-origin-common/models/scaling.rb', line 14 def from_descriptor(spec_hash = {}) self.min = spec_hash["Min"].to_i || 1 self.max = spec_hash["Max"].to_i || -1 self end |
#to_descriptor ⇒ Object
20 21 22 23 24 25 |
# File 'lib/openshift-origin-common/models/scaling.rb', line 20 def to_descriptor { "Min" => self.min, "Max" => self.max } end |