Class: Chemistry::Temperature::Kelvin

Inherits:
Unit
  • Object
show all
Defined in:
lib/chemistry/temperature/kelvin.rb

Instance Method Summary collapse

Methods inherited from Unit

#initialize, #to_f, #to_i

Constructor Details

This class inherits a constructor from Chemistry::Temperature::Unit

Instance Method Details

#==(other) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/chemistry/temperature/kelvin.rb', line 23

def ==(other)
  if other.kind_of? Chemistry::Temperature::Kelvin
    to_f == other.to_f
  else
    false
  end
end

#convert_to_celsiusObject



19
20
21
# File 'lib/chemistry/temperature/kelvin.rb', line 19

def convert_to_celsius
  @temperature - 273.15
end

#to_celsiusObject



11
12
13
# File 'lib/chemistry/temperature/kelvin.rb', line 11

def to_celsius
  Chemistry::Temperature::Celsius.new convert_to_celsius
end

#to_fahrenheitObject



15
16
17
# File 'lib/chemistry/temperature/kelvin.rb', line 15

def to_fahrenheit
  to_celsius.to_fahrenheit
end

#to_kelvinObject



7
8
9
# File 'lib/chemistry/temperature/kelvin.rb', line 7

def to_kelvin
  self
end