class Thermostat
Public Class Methods
new()
click to toggle source
# File lib/system.rb, line 3 def initialize() @heating = Relais.new @cooling = Relais.new end
Public Instance Methods
run()
click to toggle source
# File lib/system.rb, line 25 def run() p "The heating is #{@heating.status}" p "The cooling is #{@cooling.status}" end
set(value)
click to toggle source
# File lib/system.rb, line 8 def set(value) if value > 0 @heating.on @cooling.off end if value < 0 @heating.off @cooling.on end if value == 0 @heating.off @cooling.off end end