class Einutricional::Patient

Clase para almacenar los valores antropométricos de una persona

Attributes

height[RW]
hip[RW]
waist[RW]
weight[RW]

Public Class Methods

new(name, surname, sex, age, weight, height, waist, hip, activity) click to toggle source

Constructor que recibe los datos de esa persona. @note Solo name y surname son [String], el resto son [Fixnum]

Calls superclass method
# File lib/einutricional/patient.rb, line 9
def initialize(name, surname, sex, age, weight, height, waist, hip, activity)
  super(name, surname, sex, age)
  @weight = weight
  @height = height
  @waist = waist
  @hip = hip
  @activity = activity
end

Public Instance Methods

<=>(other) click to toggle source

Operador de comparación @return -1, 0, 1 según si el imc del paciente 'self' es menor, igual o mayor que el del paciente con el que se compara

# File lib/einutricional/patient.rb, line 20
def <=>(other)
  imc <=> other.imc
end
efecto_termogeno() click to toggle source
# File lib/einutricional/patient.rb, line 52
def efecto_termogeno
  (gasto_energetico_basal * 0.10).round(0)
end
gasto_actividad_fisica() click to toggle source
# File lib/einutricional/patient.rb, line 56
def gasto_actividad_fisica
  f = case @activity
      when 'reposo'
        0.0
      when 'ligera'
        0.12
      when 'moderada'
        0.27
      when 'intensa'
        0.54
      else
        0.0
      end
  (gasto_energetico_basal * f).round(0)
end
gasto_energetico() click to toggle source
# File lib/einutricional/patient.rb, line 72
def gasto_energetico
  (gasto_energetico_basal + efecto_termogeno + gasto_actividad_fisica).round(0)
end
gasto_energetico_basal() click to toggle source
# File lib/einutricional/patient.rb, line 46
def gasto_energetico_basal
  geb = (10 * @weight) + (6.25 * @height * 100) - (5 * @age)
  geb += (@age == 'h' ? 5 : -161)
  geb.round(0)
end
imc() click to toggle source

Indice de Masa Corporal @return [Fixnum] el IMC

# File lib/einutricional/patient.rb, line 26
def imc
  (@weight.to_f / @height ** 2).round(2)
end
peso_teorico_ideal() click to toggle source
# File lib/einutricional/patient.rb, line 42
def peso_teorico_ideal
  (@height * 100 - 150) * 0.75 + 50
end
rcc() click to toggle source

Radio Cintura Cadera @return [Fixnum] el RCC

# File lib/einutricional/patient.rb, line 32
def rcc
  (@waist.to_f / @hip).round(2)
end
to_s() click to toggle source

Imprime los datos del paciente @return [String] los datos del paciente

# File lib/einutricional/patient.rb, line 38
def to_s
  "#{@surname}, #{@name}, #{@sex}, #{@age}, #{@weight}, #{@height}, #{@waist}, #{@hip}"
end