Class: Anthropometric
Overview
Anthropometric Object is a Child class from the Human with extented data sobre la salud.
Instance Attribute Summary collapse
-
#age ⇒ Object
getter and setter all in one.
-
#height ⇒ Object
getter and setter all in one.
-
#name ⇒ Object
getter and setter all in one.
-
#sex ⇒ Object
getter and setter all in one.
-
#surname ⇒ Object
getter and setter all in one.
-
#weight ⇒ Object
getter and setter all in one.
Instance Method Summary collapse
-
#arm_to_s ⇒ char
Returns a string containing Triceps of an Anthropometric.
-
#biceps_to_s ⇒ char
Returns a string containing Biceps of an Anthropometric.
-
#height_to_s ⇒ char
Returns a string containing Height of an Anthropometric.
-
#hip_to_s ⇒ char
Returns a string containing Hip of an Anthropometric.
-
#imc ⇒ char
Returns the calculated IMC of an Anthropometric.
-
#initialize(name, surname, sex, age, height, weight, waist, hip, triceps, bicipital, subscapular, suprailiac, arm) ⇒ nil
constructor
[nothing].
-
#porc_fat ⇒ char
Returns the calculated percentage of fat of an Anthropometric.
-
#rcc ⇒ char
Returns the calculated RCC of an Anthropometric.
-
#subscapular_to_s ⇒ char
Returns a string containing Subcapular of an Anthropometric.
-
#suprailiac_to_s ⇒ char
Returns a string containing Suprailiac of an Anthropometric.
-
#triceps_to_s ⇒ char
Returns a string containing Triceps of an Anthropometric.
-
#uni_med(li) ⇒ float
Universal Median Calculator.
-
#waist_to_s ⇒ char
Returns a string containing Waist of an Anthropometric.
-
#weight_to_s ⇒ char
Returns a string containing Weight of an Anthropometric.
Methods inherited from Human
#<=>, #age_to_s, #name_to_s, #sex_to_s, #surname_to_s, #to_s
Constructor Details
#initialize(name, surname, sex, age, height, weight, waist, hip, triceps, bicipital, subscapular, suprailiac, arm) ⇒ nil
Returns [nothing].
108 109 110 111 |
# File 'lib/prct06/human.rb', line 108 def initialize(name, surname, sex, age, height, weight, waist, hip, triceps, bicipital, subscapular, suprailiac, arm) super(name, surname, sex, age) @height, @weight, @waist, @hip, @triceps, @bicipital, @subscapular, @suprailiac, @arm = height, weight, waist, hip, triceps, bicipital, subscapular, suprailiac, arm end |
Instance Attribute Details
#age ⇒ Object
getter and setter all in one
89 90 91 |
# File 'lib/prct06/human.rb', line 89 def age @age end |
#height ⇒ Object
getter and setter all in one
89 90 91 |
# File 'lib/prct06/human.rb', line 89 def height @height end |
#name ⇒ Object
getter and setter all in one
89 90 91 |
# File 'lib/prct06/human.rb', line 89 def name @name end |
#sex ⇒ Object
getter and setter all in one
89 90 91 |
# File 'lib/prct06/human.rb', line 89 def sex @sex end |
#surname ⇒ Object
getter and setter all in one
89 90 91 |
# File 'lib/prct06/human.rb', line 89 def surname @surname end |
#weight ⇒ Object
getter and setter all in one
89 90 91 |
# File 'lib/prct06/human.rb', line 89 def weight @weight end |
Instance Method Details
#arm_to_s ⇒ char
Returns a string containing Triceps of an Anthropometric
181 182 183 |
# File 'lib/prct06/human.rb', line 181 def arm_to_s return uni_med(@arm) end |
#biceps_to_s ⇒ char
Returns a string containing Biceps of an Anthropometric
157 158 159 |
# File 'lib/prct06/human.rb', line 157 def biceps_to_s return uni_med(@bicipital) end |
#height_to_s ⇒ char
Returns a string containing Height of an Anthropometric
117 118 119 |
# File 'lib/prct06/human.rb', line 117 def height_to_s "Height: #{@height}\n" end |
#hip_to_s ⇒ char
Returns a string containing Hip of an Anthropometric
141 142 143 |
# File 'lib/prct06/human.rb', line 141 def hip_to_s return uni_med(@hip) end |
#imc ⇒ char
Returns the calculated IMC of an Anthropometric
203 204 205 |
# File 'lib/prct06/human.rb', line 203 def imc return (@weight/@height**2).round(2) end |
#porc_fat ⇒ char
Returns the calculated percentage of fat of an Anthropometric
219 220 221 |
# File 'lib/prct06/human.rb', line 219 def porc_fat return (1.2 * imc + 0.23 * @age - 10.8 * @sex -5.4).round(2) end |
#rcc ⇒ char
Returns the calculated RCC of an Anthropometric
211 212 213 |
# File 'lib/prct06/human.rb', line 211 def rcc return (waist_to_s()/hip_to_s).round(2) end |
#subscapular_to_s ⇒ char
Returns a string containing Subcapular of an Anthropometric
165 166 167 |
# File 'lib/prct06/human.rb', line 165 def subscapular_to_s return uni_med(@subscapular) end |
#suprailiac_to_s ⇒ char
Returns a string containing Suprailiac of an Anthropometric
173 174 175 |
# File 'lib/prct06/human.rb', line 173 def suprailiac_to_s return uni_med(@suprailiac) end |
#triceps_to_s ⇒ char
Returns a string containing Triceps of an Anthropometric
149 150 151 |
# File 'lib/prct06/human.rb', line 149 def triceps_to_s return uni_med(@triceps) end |
#uni_med(li) ⇒ float
Universal Median Calculator
190 191 192 193 194 195 196 197 |
# File 'lib/prct06/human.rb', line 190 def uni_med(li) sum, i = 0, 0 while(i < li.length) sum += li[i] i += 1 end return (sum/li.length).round(2) end |
#waist_to_s ⇒ char
Returns a string containing Waist of an Anthropometric
133 134 135 |
# File 'lib/prct06/human.rb', line 133 def waist_to_s return uni_med(@waist) end |
#weight_to_s ⇒ char
Returns a string containing Weight of an Anthropometric
125 126 127 |
# File 'lib/prct06/human.rb', line 125 def weight_to_s "Weight: #{@weight}\n" end |