Class: OpenShift::Scaling

Inherits:
Model
  • Object
show all
Defined in:
lib/openshift-origin-common/models/scaling.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#initializeScaling

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

#generatedObject

Returns the value of attribute generated.



3
4
5
# File 'lib/openshift-origin-common/models/scaling.rb', line 3

def generated
  @generated
end

#maxObject

Returns the value of attribute max.



3
4
5
# File 'lib/openshift-origin-common/models/scaling.rb', line 3

def max
  @max
end

#minObject

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_descriptorObject



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