Class: Rubybody::Person

Inherits:
Object
  • Object
show all
Defined in:
lib/rubybody/person.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(weight_in_kg, height_in_cm, age, gender, activity = :sedentary, bodyfat = 0, waist = 0) ⇒ Person

All units are in the SI standard



8
9
10
11
12
13
14
15
16
# File 'lib/rubybody/person.rb', line 8

def initialize(weight_in_kg, height_in_cm, age, gender, activity=:sedentary, bodyfat=0, waist=0)
  self.weight_in_kg = weight_in_kg
  self.height_in_cm = height_in_cm
  self.age = age
  self.gender = gender
  self.activity = activity
  self.bodyfat = bodyfat
  self.waist = waist
end

Instance Attribute Details

#activityObject

Returns the value of attribute activity.



5
6
7
# File 'lib/rubybody/person.rb', line 5

def activity
  @activity
end

#ageObject

Returns the value of attribute age.



5
6
7
# File 'lib/rubybody/person.rb', line 5

def age
  @age
end

#bodyfatObject

Returns the value of attribute bodyfat.



5
6
7
# File 'lib/rubybody/person.rb', line 5

def bodyfat
  @bodyfat
end

#genderObject

Returns the value of attribute gender.



5
6
7
# File 'lib/rubybody/person.rb', line 5

def gender
  @gender
end

#height_in_cmObject

Returns the value of attribute height_in_cm.



5
6
7
# File 'lib/rubybody/person.rb', line 5

def height_in_cm
  @height_in_cm
end

#waistObject

Returns the value of attribute waist.



5
6
7
# File 'lib/rubybody/person.rb', line 5

def waist
  @waist
end

#weight_in_kgObject

Returns the value of attribute weight_in_kg.



5
6
7
# File 'lib/rubybody/person.rb', line 5

def weight_in_kg
  @weight_in_kg
end

Instance Method Details

#bmr(method = :mifflin_st_jeor) ⇒ Object



18
19
20
# File 'lib/rubybody/person.rb', line 18

def bmr(method=:mifflin_st_jeor)
  Rubybody::bmr(weight_in_kg, height_in_cm, age, gender, method)
end

#tdeeObject



22
23
24
# File 'lib/rubybody/person.rb', line 22

def tdee
  Rubybody::tdee(bmr, activity)
end