Class: Paciente
Instance Attribute Summary collapse
-
#efecto_t ⇒ Object
readonly
Returns the value of attribute efecto_t.
-
#gasto_e_basal ⇒ Object
readonly
Returns the value of attribute gasto_e_basal.
-
#peso ⇒ Object
readonly
Returns the value of attribute peso.
-
#peso_teorico_ideal ⇒ Object
readonly
Returns the value of attribute peso_teorico_ideal.
-
#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
- #calcular_efecto_t ⇒ Object
- #calcular_gasto_e_basal ⇒ Object
- #calcular_imc ⇒ Object
- #calcular_peso_ideal ⇒ Object
- #clasificar_imc ⇒ Object
- #gasto_a_fisica(actividad) ⇒ Object
- #gasto_e_total(actividad) ⇒ Object
-
#initialize(nombre, edad, peso, talla, sexo) ⇒ Paciente
constructor
A new instance of Paciente.
- #to_s ⇒ Object
Methods inherited from Individuo
Constructor Details
#initialize(nombre, edad, peso, talla, sexo) ⇒ Paciente
Returns a new instance of Paciente.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/Ein/paciente.rb', line 6 def initialize(nombre, edad, peso, talla, sexo) super(nombre, edad) @peso = peso @talla = talla @sexo = sexo @peso_teorico_ideal = calcular_peso_ideal @gasto_e_basal = calcular_gasto_e_basal @efecto_t = calcular_efecto_t end |
Instance Attribute Details
#efecto_t ⇒ Object (readonly)
Returns the value of attribute efecto_t.
4 5 6 |
# File 'lib/Ein/paciente.rb', line 4 def efecto_t @efecto_t end |
#gasto_e_basal ⇒ Object (readonly)
Returns the value of attribute gasto_e_basal.
4 5 6 |
# File 'lib/Ein/paciente.rb', line 4 def gasto_e_basal @gasto_e_basal end |
#peso ⇒ Object (readonly)
Returns the value of attribute peso.
4 5 6 |
# File 'lib/Ein/paciente.rb', line 4 def peso @peso end |
#peso_teorico_ideal ⇒ Object (readonly)
Returns the value of attribute peso_teorico_ideal.
4 5 6 |
# File 'lib/Ein/paciente.rb', line 4 def peso_teorico_ideal @peso_teorico_ideal end |
#sexo ⇒ Object (readonly)
Returns the value of attribute sexo.
4 5 6 |
# File 'lib/Ein/paciente.rb', line 4 def sexo @sexo end |
#talla ⇒ Object (readonly)
Returns the value of attribute talla.
4 5 6 |
# File 'lib/Ein/paciente.rb', line 4 def talla @talla end |
Instance Method Details
#calcular_efecto_t ⇒ Object
41 42 43 44 45 |
# File 'lib/Ein/paciente.rb', line 41 def calcular_efecto_t (@gasto_e_basal * 0.10).round(2) end |
#calcular_gasto_e_basal ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/Ein/paciente.rb', line 31 def calcular_gasto_e_basal talla_i = @talla * 100 if(@sexo == "Mujer") ((10*@peso)+(6.25*talla_i) - (5*@edad) - 161).round(2) else ((10*@peso)+(6.25*talla_i) - (5*@edad) - 5).round(2) end end |
#calcular_imc ⇒ Object
18 19 20 21 22 |
# File 'lib/Ein/paciente.rb', line 18 def calcular_imc ( @peso/(@talla*@talla)).round(2) end |
#calcular_peso_ideal ⇒ Object
24 25 26 27 28 29 |
# File 'lib/Ein/paciente.rb', line 24 def calcular_peso_ideal talla_i = @talla * 100 ((talla_i - 150) * 0.75 + 50).round(2) end |
#clasificar_imc ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/Ein/paciente.rb', line 66 def clasificar_imc imc = calcular_imc if(imc < 18.5) "Bajo peso -- Delgado" elsif(imc >= 18.5 && imc <= 24.9) "Adecuado -- Aceptable" elsif(imc >= 25 && imc <=29.9) "Sobrepeso -- Sobrepeso" elsif(imc >= 30 && imc <= 34.9) "Obesidad grado 1 -- Obesidad" elsif(imc >= 35 && imc <= 39.9) "Obesidad grado 2 -- Obesidad" elsif(imc >= 40) "Obesidad grado 3 -- Obesidad" end end |
#gasto_a_fisica(actividad) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/Ein/paciente.rb', line 47 def gasto_a_fisica(actividad) if(actividad == "Reposo") (@gasto_e_basal * 0.0).round(2) elsif(actividad == "Actividad ligera") (@gasto_e_basal * 0.12).round(2) elsif (actividad == "Actividad moderada") (@gasto_e_basal * 0.27).round(2) elsif (actividad == "Actividad intensa") (@gasto_e_basal * 0.54).round(2) end end |
#gasto_e_total(actividad) ⇒ Object
61 62 63 64 |
# File 'lib/Ein/paciente.rb', line 61 def gasto_e_total(actividad) ( @gasto_e_basal + @efecto_t + gasto_a_fisica(actividad)).round(2) end |
#to_s ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/Ein/paciente.rb', line 84 def to_s puts "------------------------------------------------------------------------------- \n" puts "\t Nombre: #{@nombre}" puts "\t Edad: #{@edad}" puts "\t Sexo: #{@sexo}" puts "\t Peso: #{@peso}" puts "\t Talla: #{@talla}" puts "\t Resultado de su imc: #{clasificar_imc}" puts "------------------------------------------------------------------------------- \n" end |