class Regulation
Attributes
cooling[R]
current_temperature[R]
heating[R]
range[R]
wanted_temperature[R]
Public Class Methods
new(wanted_temperature, range)
click to toggle source
# File lib/regulation.rb, line 7 def initialize(wanted_temperature, range) @wanted_temperature = wanted_temperature @range = range @heating = false @cooling = false end
Public Instance Methods
regulation(current_temperature)
click to toggle source
# File lib/regulation.rb, line 15 def regulation(current_temperature) @cooling = false @heating = false if current_temperature < (wanted_temperature - @range) @heating = true elsif current_temperature > (wanted_temperature + @range) @cooling = true end end