class Temperature

Public Instance Methods

convert(temp, unit) click to toggle source

this method will convert the temperature to Celsius

# File lib/temperature.rb, line 3
def convert(temp, unit)
    if(unit == "C")
        @temp = temp
    elsif(unit == "K")
        @temp = temp - 273.15
    elsif(unit == "F")
        @temp = ((temp - 32) * 5 / 9)
    else
        @temp = temp
    end
end