Class: PacienteM
- Defined in:
- lib/alu0101042305/persona.rb
Direct Known Subclasses
Constant Summary collapse
- @@factorAct =
{'ninguna' => 0, 'ligera' => 0.12, 'moderada' => 0.27, 'intensa' => 0.54}
Instance Attribute Summary collapse
-
#cadera ⇒ Object
readonly
Returns the value of attribute cadera.
-
#cintura ⇒ Object
readonly
Returns the value of attribute cintura.
-
#edad ⇒ Object
readonly
Returns the value of attribute edad.
-
#menu ⇒ Object
readonly
Returns the value of attribute menu.
-
#peso ⇒ Object
readonly
Returns the value of attribute peso.
-
#talla ⇒ Object
readonly
Returns the value of attribute talla.
Attributes inherited from Paciente
Attributes inherited from Persona
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #actividad ⇒ Object
- #addMenu(menu) ⇒ Object
- #basal ⇒ Object
- #imc ⇒ Object
-
#initialize(nombre, sexo, consulta, peso, talla, edad, cintura, cadera, act = 'ninguna') ⇒ PacienteM
constructor
A new instance of PacienteM.
- #menuOk? ⇒ Boolean
- #pesoIdeal ⇒ Object
- #termogeno ⇒ Object
- #to_s ⇒ Object
- #total ⇒ Object
Constructor Details
#initialize(nombre, sexo, consulta, peso, talla, edad, cintura, cadera, act = 'ninguna') ⇒ PacienteM
Returns a new instance of PacienteM.
44 45 46 47 |
# File 'lib/alu0101042305/persona.rb', line 44 def initialize(nombre,sexo,consulta,peso,talla,edad,cintura,cadera,act = 'ninguna') super(nombre,sexo,consulta) @peso,@talla,@edad,@cintura,@cadera,@act = peso,talla,edad,cintura,cadera,act end |
Instance Attribute Details
#cadera ⇒ Object (readonly)
Returns the value of attribute cadera.
40 41 42 |
# File 'lib/alu0101042305/persona.rb', line 40 def cadera @cadera end |
#cintura ⇒ Object (readonly)
Returns the value of attribute cintura.
40 41 42 |
# File 'lib/alu0101042305/persona.rb', line 40 def cintura @cintura end |
#edad ⇒ Object (readonly)
Returns the value of attribute edad.
40 41 42 |
# File 'lib/alu0101042305/persona.rb', line 40 def edad @edad end |
#menu ⇒ Object (readonly)
Returns the value of attribute menu.
40 41 42 |
# File 'lib/alu0101042305/persona.rb', line 40 def end |
#peso ⇒ Object (readonly)
Returns the value of attribute peso.
40 41 42 |
# File 'lib/alu0101042305/persona.rb', line 40 def peso @peso end |
#talla ⇒ Object (readonly)
Returns the value of attribute talla.
40 41 42 |
# File 'lib/alu0101042305/persona.rb', line 40 def talla @talla end |
Instance Method Details
#<=>(other) ⇒ Object
85 86 87 88 89 |
# File 'lib/alu0101042305/persona.rb', line 85 def <=> other raise TypeError, "Se esperaba un objeto Persona" unless other.is_a?Persona return self.imc <=> other.imc if other.is_a?PacienteM return -1 end |
#actividad ⇒ Object
69 70 71 |
# File 'lib/alu0101042305/persona.rb', line 69 def actividad (basal * @@factorAct[@act]).round(2) end |
#addMenu(menu) ⇒ Object
49 50 51 |
# File 'lib/alu0101042305/persona.rb', line 49 def addMenu() = end |
#basal ⇒ Object
61 62 63 |
# File 'lib/alu0101042305/persona.rb', line 61 def basal (10 * peso + 6.25 * talla * 100 - 5 * edad + (sexo == 'mujer'? -161 : 5)).round(2) end |
#imc ⇒ Object
77 78 79 |
# File 'lib/alu0101042305/persona.rb', line 77 def imc @peso/(@talla * @talla) end |
#menuOk? ⇒ Boolean
53 54 55 |
# File 'lib/alu0101042305/persona.rb', line 53 def ((total * 0.9)..(total * 1.1)).include? .kcal end |
#pesoIdeal ⇒ Object
57 58 59 |
# File 'lib/alu0101042305/persona.rb', line 57 def pesoIdeal (talla * 100 - 150) * 0.75 + 50 end |
#termogeno ⇒ Object
65 66 67 |
# File 'lib/alu0101042305/persona.rb', line 65 def termogeno (basal * 0.1).round(2) end |
#to_s ⇒ Object
81 82 83 |
# File 'lib/alu0101042305/persona.rb', line 81 def to_s super.to_s + " y en tratamiento" end |
#total ⇒ Object
73 74 75 |
# File 'lib/alu0101042305/persona.rb', line 73 def total basal + termogeno + actividad end |