Class: TemperatureConvertToFahrenheit

Inherits:
Object
  • Object
show all
Defined in:
lib/temperature_convert_to_fahrenheit.rb

Constant Summary collapse

FAHRENHEIT_OFFSET =
32
FAHRENHEIT_SLOPE =
Rational(9,5)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#tempObject (readonly)

Returns the value of attribute temp.



5
6
7
# File 'lib/temperature_convert_to_fahrenheit.rb', line 5

def temp
  @temp
end

Class Method Details

.to_fahrenheit(temp) ⇒ Object


converting



11
12
13
# File 'lib/temperature_convert_to_fahrenheit.rb', line 11

def self.to_fahrenheit(temp)
  (temp.to_f * FAHRENHEIT_SLOPE) + FAHRENHEIT_OFFSET
end