Class: WeatherData::Temperature::Fahrenheit

Inherits:
Base
  • Object
show all
Defined in:
lib/weather_data/temperature/fahrenheit.rb

Instance Attribute Summary

Attributes inherited from Base

#degrees

Instance Method Summary collapse

Methods inherited from Base

#*, #+, #-, #-@, #/, #<=>, #==, #initialize, #to_f, #to_i

Constructor Details

This class inherits a constructor from WeatherData::Temperature::Base

Instance Method Details

#to_celsiusObject



6
7
8
# File 'lib/weather_data/temperature/fahrenheit.rb', line 6

def to_celsius
  Celsius.new((degrees - 32) * 5.0 / 9)
end

#to_fahrenheitObject



10
11
12
# File 'lib/weather_data/temperature/fahrenheit.rb', line 10

def to_fahrenheit
  self
end

#to_kelvinObject



14
15
16
# File 'lib/weather_data/temperature/fahrenheit.rb', line 14

def to_kelvin
  to_celsius.to_kelvin
end

#to_sObject



18
19
20
# File 'lib/weather_data/temperature/fahrenheit.rb', line 18

def to_s
  "#{degrees}°F"
end