Class: Pulo::Temperature
- Inherits:
-
Object
- Object
- Pulo::Temperature
- Defined in:
- lib/pulo/quantity/quantity_definitions/basic.rb
Instance Method Summary collapse
Instance Method Details
#celsius ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/pulo/quantity/quantity_definitions/basic.rb', line 130 def celsius case self.unit.name when :celcius self when :kelvin self.class.new(self.value-273.15, :celsius) when :fahrenheit self.class.new((5.0/9.0*(self.value-32.0)), :celsius) else self end end |
#fahrenheit ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/pulo/quantity/quantity_definitions/basic.rb', line 143 def fahrenheit case self.unit.name when :fahrenheit self when :celsius self.class.new((9.0/5.0*self.value)+32.0, :fahrenheit) when :kelvin self.class.new((9.0/5.0*(self.value-273.15))+32.0, :fahrenheit) else self end end |
#kelvin ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/pulo/quantity/quantity_definitions/basic.rb', line 117 def kelvin case self.unit.name when :kelvin self when :celsius self.class.new(self.value+273.15, :kelvin) when :fahrenheit self.class.new((5.0/9.0*(self.value-32.0))+273.15, :kelvin) else self end end |