class Convert
Attributes
endWantedTemp[R]
endrange[R]
endtemp[R]
Public Class Methods
new(currentTemp,range,wantedTemp,unit)
click to toggle source
# File lib/convert.rb, line 5 def initialize(currentTemp,range,wantedTemp,unit) @currentTemp = currentTemp @range = range @wantedTemp = wantedTemp @unit = unit end
Public Instance Methods
convert_temp()
click to toggle source
# File lib/convert.rb, line 12 def convert_temp() if (@unit == "f") @endtemp = @currentTemp * 1.8 + 32 @endrange = @range * 1.8 @endWantedTemp = @wantedTemp * 1.8 + 32 elsif (@unit == "k") @endtemp = @currentTemp + 273.15 @endrange = @range * 2.7 @endWantedTemp = @wantedTemp + 273.15 elsif (@unit =="c") @endtemp = @currentTemp @endrange = @range @endWantedTemp = @wantedTemp end end