Class: WeatherData::Temperature::Celsius
- Inherits:
-
Base
- Object
- Base
- WeatherData::Temperature::Celsius
show all
- Defined in:
- lib/weather_data/temperature/celsius.rb
Instance Attribute Summary
Attributes inherited from Base
#degrees
Instance Method Summary
collapse
Methods inherited from Base
#*, #+, #-, #-@, #/, #<=>, #==, #initialize, #to_f, #to_i
Instance Method Details
#to_celsius ⇒ Object
6
7
8
|
# File 'lib/weather_data/temperature/celsius.rb', line 6
def to_celsius
self
end
|
#to_fahrenheit ⇒ Object
10
11
12
|
# File 'lib/weather_data/temperature/celsius.rb', line 10
def to_fahrenheit
Fahrenheit.new(degrees * 9.0 / 5 + 32)
end
|
#to_kelvin ⇒ Object
14
15
16
|
# File 'lib/weather_data/temperature/celsius.rb', line 14
def to_kelvin
Kelvin.new(degrees + 273.15)
end
|
#to_s ⇒ Object
18
19
20
|
# File 'lib/weather_data/temperature/celsius.rb', line 18
def to_s
"#{degrees}°C"
end
|