Class: Individuos
- Inherits:
-
IMC
show all
- Includes:
- Comparable
- Defined in:
- lib/NutrientesEdu/version.rb,
lib/NutrientesEdu/Individuo.rb
Constant Summary
collapse
- VERSION =
"0.1.0"
Instance Attribute Summary collapse
Attributes inherited from IMC
#altura, #edad, #peso, #sexo
Instance Method Summary
collapse
Methods inherited from IMC
#<=>, #calcular_imc, #porcentaje_grasa
Constructor Details
#initialize(nombre, paciente, tratamiento, peso, talla, edad, sexo, f_af) ⇒ Individuos
Returns a new instance of Individuos.
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/NutrientesEdu/Individuo.rb', line 9
def initialize(nombre, paciente, tratamiento, peso, talla, edad, sexo, f_af)
@nombre=nombre
@paciente=paciente
@tratamiento=tratamiento
@f_af=f_af
@peso=peso
@talla=talla
@edad=edad
@sexo=sexo
if @paciente==1
super(peso,talla,edad,sexo)
end
end
|
Instance Attribute Details
#nombre ⇒ Object
Returns the value of attribute nombre.
7
8
9
|
# File 'lib/NutrientesEdu/Individuo.rb', line 7
def nombre
@nombre
end
|
#paciente ⇒ Object
Returns the value of attribute paciente.
7
8
9
|
# File 'lib/NutrientesEdu/Individuo.rb', line 7
def paciente
@paciente
end
|
#tratamiento ⇒ Object
Returns the value of attribute tratamiento.
7
8
9
|
# File 'lib/NutrientesEdu/Individuo.rb', line 7
def tratamiento
@tratamiento
end
|
Instance Method Details
#clas_imc ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/NutrientesEdu/Individuo.rb', line 23
def clas_imc
if calcular_imc < 30
return "Normal"
else
return "Obeso"
end
end
|
#e_term ⇒ Object
39
40
41
|
# File 'lib/NutrientesEdu/Individuo.rb', line 39
def e_term
return g_e_basal*0.10
end
|
#g_act_fis ⇒ Object
43
44
45
|
# File 'lib/NutrientesEdu/Individuo.rb', line 43
def g_act_fis
return g_e_basal*@f_af
end
|
#g_e_basal ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/NutrientesEdu/Individuo.rb', line 31
def g_e_basal
if(@sexo == 0)
return 10*@peso+6.25*@talla-5*@edad-161
else
return 10*@peso+6.25*@talla-5*@edad+5
end
end
|
#g_en_total ⇒ Object
47
48
49
|
# File 'lib/NutrientesEdu/Individuo.rb', line 47
def g_en_total
return g_e_basal+e_term+g_act_fis
end
|
#to_s ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/NutrientesEdu/Individuo.rb', line 52
def to_s
rval = "#{@nombre} #{g_en_total}"
if(@tratamiento == 1)
rval += super
end
return rval
end
|