class Thermostat

@author Frederik Feys

Attributes

current_value[RW]
range[RW]
wanted_value[RW]

Public Class Methods

new(current_value = 0, wanted_value = 0, range = 0) click to toggle source
# File lib/thermostat.rb, line 7
def initialize(current_value = 0, wanted_value = 0, range = 0)
  @current_value = current_value
  @current_value = wanted_value
  @range = range
end

Public Instance Methods

airco() click to toggle source
# File lib/thermostat.rb, line 30
def airco
  if @current_value > (@wanted_value + @range)
    @airco = true
    puts 'cooling'
  else
    @airco = false
  end
end
heating() click to toggle source
# File lib/thermostat.rb, line 21
def heating
  if @current_value < (@wanted_value - @range)
    @heating = true
    puts 'heating'
  else
    @heating = false
  end
end
update_current(current_value) click to toggle source
# File lib/thermostat.rb, line 13
def update_current(current_value)
  current_value = current_value
end
update_wanted(wanted_value) click to toggle source
# File lib/thermostat.rb, line 17
def update_wanted(wanted_value)
  wanted_value = wanted_value
end