class JSONThermostat
Attributes
settings[RW]
thermostat[RW]
Public Class Methods
new(settings_json)
click to toggle source
# File lib/json_thermostat.rb, line 6 def initialize(settings_json) @settings = JSON.parse(settings_json) @thermostat = Thermostat.new @thermostat.unit_set(@settings['unit']) @thermostat.wanted_temp_set(@settings['temperature']) @thermostat.range_set(@settings['range']) end
Public Instance Methods
update(temperature_json)
click to toggle source
# File lib/json_thermostat.rb, line 14 def update(temperature_json) @thermostat.unit_set(JSON.parse(temperature_json)['unit']) @thermostat.update_temp(JSON.parse(temperature_json)['temperature']) @thermostat.output end