Sha256: 6f351af6266af583f4ee42ba16ea4e3c1858fb94568309ade7893a15c2801aa4
Contents?: true
Size: 462 Bytes
Versions: 19
Compression:
Stored size: 462 Bytes
Contents
require "attr_extras" module Renalware # 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" # class BMI pattr_initialize [:weight!, :height!] delegate :to_s, to: :to_f def to_f return unless weight && height && height > 0 ((weight / height) / height).round(1) end end end
Version data entries
19 entries across 19 versions & 1 rubygems