Sha256: c78a93ab43b70a729dd0848f39237a02ac00a1ef22a43fdfa8f6a7257977f959
Contents?: true
Size: 982 Bytes
Versions: 2
Compression:
Stored size: 982 Bytes
Contents
module WeightConversion # Proxy = Kilogram def to_kilogram case @unit when 'pound' @measurement *= 0.45359 when 'ounce' @measurement *= 0.02835 when 'short_ton' @measurement *= 907.18464 when 'long_ton' @measurement *= 1016.04691 end end def to_long_ton if @unit == 'kilogram' @measurement *= 0.000984207 else self.to_kilogram @unit = 'kilogram' self.to_long_ton end end def to_short_ton if @unit == 'kilogram' @measurement *= 0.00110231 else self.to_kilogram @unit = 'kilogram' self.to_short_ton end end def to_pound if @unit == 'kilogram' @measurement *= 2.2046226218 else self.to_kilogram @unit = 'kilogram' self.to_pound end end def to_ounce if @unit == 'kilogram' @measurement *= 35.27396195 else self.to_kilogram @unit = 'kilogram' self.to_ounce end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
unit_conversion-1.0.2 | lib/unit_conversion/weight_conversion.rb |
unit_conversion-1.0.1 | lib/unit_conversion/weight_conversion.rb |