class Thermostat
The thermostat class will cool or heat, depending on the current and wanted temperature.
Attributes
current_value[RW]
range[RW]
temperature[RW]
wanted_value[RW]
Public Instance Methods
check_temp(current_value, wanted_value, range)
click to toggle source
# File lib/thermostat.rb, line 11 def check_temp(current_value, wanted_value, range) @current_value = current_value @wanted_value = wanted_value @range = range if currentValue < (wantedValue - range) thermo[:heating] = true elsif currentValue > (wantedValue + range) thermo[:cooling] = true else print('Good temp') end end
temperature_set(temperature)
click to toggle source
The temperature_set
method will set the temp.
# File lib/thermostat.rb, line 25 def temperature_set(temperature) @temperature = temperature end