Module: Rubybody::Formulas
- Defined in:
- lib/rubybody/formulas.rb
Class Method Summary collapse
- .harris_benedict(weight_in_kg, height_in_cm, age, gender) ⇒ Object
- .mifflin_st_jeor(weight_in_kg, height_in_cm, age, gender) ⇒ Object
- .typical(bmr, activity_level) ⇒ Object
Class Method Details
.harris_benedict(weight_in_kg, height_in_cm, age, gender) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rubybody/formulas.rb', line 20 def self.harris_benedict(weight_in_kg, height_in_cm, age, gender) case gender.to_sym when :male return 66 + 6.23*(weight_in_kg * 2.20462) + 12.7*(height_in_cm * 0.393701) - 6.76 * age when :female return 655 + 4.35*(weight_in_kg * 2.20462) + 4.7*(height_in_cm * 0.393701) - 4.7 * age end end |
.mifflin_st_jeor(weight_in_kg, height_in_cm, age, gender) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rubybody/formulas.rb', line 5 def self.mifflin_st_jeor(weight_in_kg, height_in_cm, age, gender) base = 10*weight_in_kg + 6.25*height_in_cm - 5*age case gender.to_sym when :male return base + 5 when :female return base - 161 else raise "ArgumentException" end end |
.typical(bmr, activity_level) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rubybody/formulas.rb', line 31 def self.typical(bmr, activity_level) case activity_level.to_sym when :sedentary return bmr * 1.2 when :lightly_active return bmr * 1.375 when :moderately_active return bmr * 1.55 when :very_active return bmr * 1.75 when :extra_active return bmr * 1.9 else raise "ArgumentException" end end |