Sha256: ecf095f557edd672fd936fc7d6c28f38e70b299b66fd31bfaafb8eb5965fac78
Contents?: true
Size: 293 Bytes
Versions: 2
Compression:
Stored size: 293 Bytes
Contents
module Forecastr class Temperature def initialize(kelvin) @kelvin = kelvin end def to_celsius (@kelvin - 273.15).round(2) end def to_farenheit (1.8 * (@kelvin - 273.15) + 32).round(2) end def to_s "#{to_celsius} °C" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
forecastr-0.1.4 | lib/forecastr/temperature.rb |
forecastr-0.1.3 | lib/forecastr/temperature.rb |