class DataReader
Attributes
ideal_temperature[W]
online_data[W]
range[W]
temperature[W]
unit[W]
Public Instance Methods
ask_ideal_temp()
click to toggle source
# File lib/datareader.rb, line 38 def ask_ideal_temp puts "Whats the ideal temperature?" @ideal_temperature = gets.to_i end
ask_range()
click to toggle source
# File lib/datareader.rb, line 33 def ask_range puts "Whats your range?" @range = gets.to_i end
ask_temp()
click to toggle source
# File lib/datareader.rb, line 43 def ask_temp puts "Whats the temperature?" @temperature = gets.to_i end
ask_unit()
click to toggle source
Asks in PS what the unit is
# File lib/datareader.rb, line 28 def ask_unit puts "Whats your temp. unit? [C]celcius, [F]Fahrenheit, [K]Kelvin" @unit = gets.downcase.delete!("\n") end
get_ideal_temperature()
click to toggle source
# File lib/datareader.rb, line 56 def get_ideal_temperature return @ideal_temperature end
get_online_temperature()
click to toggle source
Returns the online temperature
# File lib/datareader.rb, line 23 def get_online_temperature return @online_data end
get_range()
click to toggle source
# File lib/datareader.rb, line 52 def get_range return @range end
get_temperature()
click to toggle source
# File lib/datareader.rb, line 60 def get_temperature return @temperature end
get_unit()
click to toggle source
# File lib/datareader.rb, line 48 def get_unit return @unit end
read_online_temperature()
click to toggle source
Reads the online temperature when called
# File lib/datareader.rb, line 17 def read_online_temperature temperature_uri = "https://labict.be/software-engineering/temperature/api/temperature/fake" @online_data = URI.parse(temperature_uri).read end