Sha256: cc5c9308116e65d53bc115619439a334e18b6d12788cc9e1578ba57aa52b418f
Contents?: true
Size: 493 Bytes
Versions: 28
Compression:
Stored size: 493 Bytes
Contents
# frozen_string_literal: true 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
28 entries across 28 versions & 1 rubygems