Class: Individuo

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/menud/menud.rb

Overview

including mixin Comparable

  • method initialize

  • method to_s

  • method to_f

  • method to_i

  • method <=>

Direct Known Subclasses

Consulta

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nombre, apellidos, edad, genero, peso, talla, cadera, cintura, imc, porcentgrasa, rcc, peso_t_i, gasto_e_basal, efecto_t_a, gasto_ef, factor_actvf, gasto_e_total) ⇒ Individuo

Method to initialize every anthropometric measures



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/menud/menud.rb', line 29

def initialize(nombre, apellidos, edad, genero, peso, talla, cadera, cintura, imc, porcentgrasa, rcc, peso_t_i, gasto_e_basal, efecto_t_a, gasto_ef, factor_actvf, gasto_e_total)

        
       
        
                    
                @nombre = nombre
                @apellidos = apellidos
                @edad = edad
                @genero = genero
                @peso = peso
                @talla = talla
                @cadera = cadera
                @cintura = cintura
                @imc = imc
                @porcentgrasa = porcentgrasa
                @rcc = rcc
                @peso_t_i = peso_t_i
                @gasto_e_basal = gasto_e_basal
                @efecto_t_a = efecto_t_a
                @gasto_ef = gasto_ef
                @factor_actvf = factor_actvf
                @gasto_e_total = gasto_e_total
                
                    
                    
end

Instance Attribute Details

#apellidosObject

Returns the value of attribute apellidos.



26
27
28
# File 'lib/menud/menud.rb', line 26

def apellidos
  @apellidos
end

#caderaObject

Returns the value of attribute cadera.



26
27
28
# File 'lib/menud/menud.rb', line 26

def cadera
  @cadera
end

#cinturaObject

Returns the value of attribute cintura.



26
27
28
# File 'lib/menud/menud.rb', line 26

def cintura
  @cintura
end

#edadObject

Returns the value of attribute edad.



26
27
28
# File 'lib/menud/menud.rb', line 26

def edad
  @edad
end

#efecto_t_aObject

Returns the value of attribute efecto_t_a.



26
27
28
# File 'lib/menud/menud.rb', line 26

def efecto_t_a
  @efecto_t_a
end

#factor_actvfObject

Returns the value of attribute factor_actvf.



26
27
28
# File 'lib/menud/menud.rb', line 26

def factor_actvf
  @factor_actvf
end

#gasto_e_basalObject

Returns the value of attribute gasto_e_basal.



26
27
28
# File 'lib/menud/menud.rb', line 26

def gasto_e_basal
  @gasto_e_basal
end

#gasto_e_totalObject

Returns the value of attribute gasto_e_total.



26
27
28
# File 'lib/menud/menud.rb', line 26

def gasto_e_total
  @gasto_e_total
end

#gasto_efObject

Returns the value of attribute gasto_ef.



26
27
28
# File 'lib/menud/menud.rb', line 26

def gasto_ef
  @gasto_ef
end

#generoObject

Returns the value of attribute genero.



26
27
28
# File 'lib/menud/menud.rb', line 26

def genero
  @genero
end

#imcObject

Returns the value of attribute imc.



26
27
28
# File 'lib/menud/menud.rb', line 26

def imc
  @imc
end

#nombreObject

Returns the value of attribute nombre.



26
27
28
# File 'lib/menud/menud.rb', line 26

def nombre
  @nombre
end

#pesoObject

Returns the value of attribute peso.



26
27
28
# File 'lib/menud/menud.rb', line 26

def peso
  @peso
end

#peso_t_iObject

Returns the value of attribute peso_t_i.



26
27
28
# File 'lib/menud/menud.rb', line 26

def peso_t_i
  @peso_t_i
end

#porcentgrasaObject

Returns the value of attribute porcentgrasa.



26
27
28
# File 'lib/menud/menud.rb', line 26

def porcentgrasa
  @porcentgrasa
end

#rccObject

Returns the value of attribute rcc.



26
27
28
# File 'lib/menud/menud.rb', line 26

def rcc
  @rcc
end

#tallaObject

Returns the value of attribute talla.



26
27
28
# File 'lib/menud/menud.rb', line 26

def talla
  @talla
end

Instance Method Details

#<=>(other) ⇒ Object

Method to get the value of imc and do the comparison



66
67
68
69
70
71
# File 'lib/menud/menud.rb', line 66

def <=> (other)
    
    
   @imc <=> other.imc
    
end

#efecto_termogeno_alimentosObject



130
131
132
133
134
# File 'lib/menud/menud.rb', line 130

def efecto_termogeno_alimentos
    
  @efecto_t_a = (@gasto_e_basal * 0.10)  
    
end

#gasto_actividadfObject



137
138
139
140
141
# File 'lib/menud/menud.rb', line 137

def gasto_actividadf
    
 @gasto_ef = (@gasto_e_basal * @factor_actvf).round(2)
    
end

#gasto_energetico_basalObject



117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/menud/menud.rb', line 117

def gasto_energetico_basal
        
    if (@sexo = 1)
            
        @gasto_e_basal = ((10 * @peso) + (6.25 * @talla) - (5 * @edad) + 5 ) 
    
    elsif
         @gasto_e_basal = ((10 * @peso) + (6.25 * @talla) - (5 * @edad) - 161 ) 
    end
        
    
end

#gasto_energetico_tObject



144
145
146
147
148
# File 'lib/menud/menud.rb', line 144

def gasto_energetico_t
    
 @gasto_e_total = (@gasto_e_basal + @efecto_t_a + @gasto_ef)  
    
end

#peso_total_idealObject

# Method to transform into int

def to_i

        "#{@edad}"
        "#{@genero}"
        "#{@peso}"

end

# Method to transform into float
def to_f

        "#{@talla}"
        "#{@cadera}"
        "#{@cintura}"
        "#{@imc}"
        "#{@porcentgrasa}"
        "#{@rcc}"
        "#{@peso_t_i}"
        "#{@gasto_e_basal}"
        "#{@efecto_t_a}"
        "#{@gasto_ef}"
        "#{@factor_actvf}"
        "#{@gasto_e_total}"

end


110
111
112
113
114
115
# File 'lib/menud/menud.rb', line 110

def peso_total_ideal
    
@peso_t_i = ((@talla - 150) * 0.75 + 50)
    
    
end