class Temperatuur
Attributes
scale[RW]
temp[RW]
Public Class Methods
new(temp, scale)
click to toggle source
# File lib/temperatur.rb, line 6 def initialize (temp, scale) check(temp,scale); end
Public Instance Methods
check(temp,scale)
click to toggle source
Return the temperature value in degrees celsius It is also needed to provide the scale in wich the temperature is displayed @return [Number] temperature in degrees celsius @example
temperature = Temperatuure.new 374,Kelvin
# File lib/temperatur.rb, line 16 def check(temp,scale) if scale == "Celcius" @temp = temp elsif scale == "Farenheit" @temp = ((temp-32)*5/9) elsif scale == "Kelvin" @temp = temp - 273.15 else puts "nope" @temp = temp end end