Sha256: 3ba9736834ed07adbaa450af9582a350301a3de6c411defb1a13fac8d7e8cd61
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require "unit_conversion/version" class UnitConversion def initialize(measurement) @measurement = measurement end ########################### # TEMPERATURE CONVERSIONS # ########################### def celcius_to_kelvin @measurement + 273.15 end def fahrenheit_to_kelvin (@measurement + 459.67) * 5 / 9 end def rankine_to_kelvin @measurement / 1.8 end def kelvin_to_celcius @measurement - 273.15 end def kelvin_to_fahrenheit (@measurement * 9 / 5.0) - 459.67 end def kelvin_to_rankine @measurement * 1.8 end ######################## # DISTANCE CONVERSIONS # ######################## def feet_to_inch @measurement / 12.0 end def inch_to_feet @measurement * 12.0 end def feet_to_yard @measurement * 3.0 end def yard_to_feet @measurement / 3.0 end def feet_to_mile @measurement / 5280.0 end def mile_to_feet @measurement * 5280.0 end def feet_to_meter @measurement * 0.3048 end def meter_to_feet @measurement / 0.3048 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unit_conversion-0.0.2 | lib/unit_conversion.rb |