Class: Paciente
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.
-
#peso ⇒ Object
readonly
Returns the value of attribute peso.
-
#sexo ⇒ Object
readonly
Returns the value of attribute sexo.
-
#talla ⇒ Object
readonly
Returns the value of attribute talla.
Attributes inherited from Individuo
Instance Method Summary collapse
- #actividad_fisica(actividad) ⇒ Object
- #efecto_termogeno ⇒ Object
- #gasto_act_fisica(actividad) ⇒ Object
- #gasto_energetico_basal ⇒ Object
- #gasto_total(actividad) ⇒ Object
- #imc_calc ⇒ Object
-
#initialize(nombre, apellido, peso, talla, edad, sexo, cintura, cadera) ⇒ Paciente
constructor
A new instance of Paciente.
- #peso_ideal ⇒ Object
- #to_s ⇒ Object
Methods inherited from Individuo
Constructor Details
#initialize(nombre, apellido, peso, talla, edad, sexo, cintura, cadera) ⇒ Paciente
Returns a new instance of Paciente.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/tdd/valor_nutricional.rb', line 23 def initialize(nombre,apellido,peso,talla,edad,sexo,cintura,cadera) super(nombre,apellido) @peso = peso @talla = talla @edad = edad if(sexo == "Hombre") @sexo = 1; elsif(sexo == "Mujer") @sexo = 0; end @cintura = (cintura[0] + cintura[1])/2 @cadera = (cadera[0]+cadera[1])/2 end |
Instance Attribute Details
#cadera ⇒ Object (readonly)
Returns the value of attribute cadera.
21 22 23 |
# File 'lib/tdd/valor_nutricional.rb', line 21 def cadera @cadera end |
#cintura ⇒ Object (readonly)
Returns the value of attribute cintura.
21 22 23 |
# File 'lib/tdd/valor_nutricional.rb', line 21 def cintura @cintura end |
#edad ⇒ Object (readonly)
Returns the value of attribute edad.
21 22 23 |
# File 'lib/tdd/valor_nutricional.rb', line 21 def edad @edad end |
#peso ⇒ Object (readonly)
Returns the value of attribute peso.
21 22 23 |
# File 'lib/tdd/valor_nutricional.rb', line 21 def peso @peso end |
#sexo ⇒ Object (readonly)
Returns the value of attribute sexo.
21 22 23 |
# File 'lib/tdd/valor_nutricional.rb', line 21 def sexo @sexo end |
#talla ⇒ Object (readonly)
Returns the value of attribute talla.
21 22 23 |
# File 'lib/tdd/valor_nutricional.rb', line 21 def talla @talla end |
Instance Method Details
#actividad_fisica(actividad) ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'lib/tdd/valor_nutricional.rb', line 82 def actividad_fisica(actividad) return 0.0 if actividad == "Reposo" return 0.12 if actividad == "Ligera" return 0.27 if actividad == "Moderada" return 0.54 if actividad == "Intensa" end |
#efecto_termogeno ⇒ Object
76 77 78 79 80 |
# File 'lib/tdd/valor_nutricional.rb', line 76 def efecto_termogeno (gasto_energetico_basal * 0.10).round(2) end |
#gasto_act_fisica(actividad) ⇒ Object
91 92 93 94 95 |
# File 'lib/tdd/valor_nutricional.rb', line 91 def gasto_act_fisica(actividad) (actividad_fisica(actividad) * gasto_energetico_basal).round(2) end |
#gasto_energetico_basal ⇒ Object
68 69 70 71 72 73 |
# File 'lib/tdd/valor_nutricional.rb', line 68 def gasto_energetico_basal return ((10*@peso)+(6.25*@talla)-(5*@edad)+5).round(2) if @sexo == 1 ((10*@peso)+(6.25*@talla)-(5*@edad) - 161).round(2) end |
#gasto_total(actividad) ⇒ Object
97 98 99 100 101 |
# File 'lib/tdd/valor_nutricional.rb', line 97 def gasto_total(actividad) (gasto_energetico_basal + efecto_termogeno + actividad_fisica(actividad)).round(2) end |
#imc_calc ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/tdd/valor_nutricional.rb', line 38 def imc_calc @imc = (@peso/(@talla*@talla)).round(2) if(@imc < 18.5) "Delgado" elsif (@imc > 18.5 && @imc < 24.9) "Aceptable" elsif (@imc > 25 && @imc <29.9) "Sobrepeso" elsif(@imc > 30) "Obesidad" end end |
#peso_ideal ⇒ Object
62 63 64 65 66 |
# File 'lib/tdd/valor_nutricional.rb', line 62 def peso_ideal ((@talla-150)*0.75 + 50).round(2) end |
#to_s ⇒ Object
56 57 58 59 60 |
# File 'lib/tdd/valor_nutricional.rb', line 56 def to_s "#{super.to_s} #{@peso} #{@talla} #{@edad} #{@sexo} #{@cintura} #{@cadera}" end |