class Termostat
Attributes
normal[RW]
range[RW]
temperature[RW]
verschill[RW]
Public Class Methods
new(range, normal)
click to toggle source
# File lib/termostat.rb, line 6 def initialize(range, normal) @range = range @normal = normal end
Public Instance Methods
check_temp(h)
click to toggle source
# File lib/termostat.rb, line 11 def check_temp(h) if @temperature.temp>(@normal+@range) h.set_cooling @verschill = @temperature.temp - @normal elsif @temperature.temp<(@normal-@range) h.set_heating @verschill = @temperature.temp - @normal elsif (@normal-@range)<@temperature.temp and @temperature.temp<(@temperature.temp+@range) h.turn_off @verschill = 0 end end