Sha256: 00ee806e37a2026a396877f3a451730d5af490c7c8990cda75fd6d4e03c40e2f
Contents?: true
Size: 494 Bytes
Versions: 104
Compression:
Stored size: 494 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
104 entries across 104 versions & 1 rubygems