Class: Renalware::BMI
- Inherits:
-
Object
- Object
- Renalware::BMI
- Defined in:
- app/values/renalware/bmi.rb
Overview
Value object representing Body Mass Index. Accepts only meters and kg
Example usage:
bmi = Renalware::BMI.new(height: 1.80, weight: 180)
bmi.to_f # => 55.6
bmi.to_s # => "55.6"
Instance Method Summary collapse
Instance Method Details
#to_f ⇒ Object
17 18 19 20 21 |
# File 'app/values/renalware/bmi.rb', line 17 def to_f return unless weight && height && height > 0 ((weight / height) / height).round(1) end |