class Calculator

Public Instance Methods

get_intensity(cTemp, wTemp, range) click to toggle source
# File lib/calculator.rb, line 15
def get_intensity(cTemp, wTemp, range)
    difference = wTemp - cTemp
    intensity = Integer((difference/range) * 255)

    if intensity >= 255
        intensity = 255

    elsif intensity <= -255
        intensity = -255

    else
        # intesity = intesity
    end
    return intensity
end
temp_in_c(unit,temp) click to toggle source
# File lib/calculator.rb, line 2
def temp_in_c(unit,temp)
    if unit == "k"
        cTemp = temp-273.1500

    elsif unit  == "f"
        cTemp =  (temp-32)/ 1.8

    else
        cTemp = temp
    end
    return cTemp
end